Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9793

Re: Question about DayOfWeek

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Question about DayOfWeek
Date 2012-04-25 04:41 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jn7va3$6gs$1@smc.vnet.net> (permalink)
References <201204240934.FAA24505@smc.vnet.net>

Show all headers | View raw


Needs["Calendar`"]

Equal can only compare "between numbers or other raw data, such as
strings." If symbols are involved the expression will be interpreted
by Mathematica as an equation.

Head /@ {Wednesday, Thursday}

{Symbol, Symbol}

You need to use SameQ ( === ) to test whether symbols are literally
the same symbol.

Wednesday === Thursday

False

DayOfWeek[{1975, 1, 1}] === Wednesday

True

DayOfWeek[{1975, 1, 1}] === Thursday

False

Alternatively,

ToString[Wednesday] == ToString[Thursday]

False

ToString /@ (DayOfWeek[{1975, 1, 1}] == Thursday)

False


Bob Hanlon


On Tue, Apr 24, 2012 at 5:34 AM, Kent Holing <KHO@statoil.com> wrote:
> DayOfWeek[{1975,1,1}]==Wednesday gives True (as it should), but DayOfWeek[{1975,1,1}]==Thursday gives
> Wednesday == Thursday and not False, as it should? Why is it so?
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Question about DayOfWeek Bob Hanlon <hanlonr357@gmail.com> - 2012-04-25 04:41 +0000

csiph-web