Re: Question about DayOfWeek
- To: mathgroup at smc.vnet.net
- Subject: [mg126210] Re: Question about DayOfWeek
- From: István Zachar <replicatorzed at gmail.com>
- Date: Wed, 25 Apr 2012 00:34:51 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jn5s97$nvl$1@smc.vnet.net>
If I understand it correctly, the "Calendar`" package uses symbols for days instead of strings. Thus what is returned by
Needs["Calendar`"];
DayOfWeek[{1975,1,1}]==Thursday
is a symbol-to-symbol comparison (Wednesday==Thursday), just like a==b, and since none of the symbols have any value, Equal (==) is left unevaluated.
Use SameQ insted of Equal:
In[6]:= DayOfWeek[{1975, 1, 1}] === Wednesday
Out[6]= True
In[7]:= DayOfWeek[{1975, 1, 1}] === Thursday
Out[7]= False
Hope this helps,
Istvan
On Tuesday, April 24, 2012 10:37:43 AM UTC+1, Kent Holing 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?