MathGroup Archive 2012

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

Search the Archive

Re: Question about DayOfWeek

  • To: mathgroup at
  • Subject: [mg126210] Re: Question about DayOfWeek
  • From: István Zachar <replicatorzed at>
  • Date: Wed, 25 Apr 2012 00:34:51 -0400 (EDT)
  • Delivered-to:
  • References: <jn5s97$nvl$>

If I understand it correctly, the "Calendar`" package uses symbols for days instead of strings. Thus what is returned by


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,


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