MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question about DayOfWeek


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?




  • Prev by Date: Print out an Expression Letter by Letter on the same line
  • Next by Date: Re: how to check for NumericQ arbitrary data structure
  • Previous by thread: Re: Question about DayOfWeek
  • Next by thread: Re: Question about DayOfWeek