View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Incorrect results of Weekdayname(Weekday... function???

Dim myDate as Date
myDate = Range("A1").Value

the best is to work with the date serial number. Then there is no
confusion. An alternative is to use an unambiguous format like

Jan 2, 2004

Dates are stored as the number of days from a base date. In Windows, the
default is 1900. For the Mac, 1904.

I don't know specifically where you will get your date from, so it is hard
to say what you should watch out for.

--
Regards,
Tom Ogilvy



"Kobayashi " wrote in message
...
Tom,

Thanks very much, the '?
format(weekday(DateValue("05/26/2004")),"dddd")' function certainly did
the trick!

One last question if I may? I need my worksheets to be in uk date
format: dd/mm/yyyy. However, you have made me a bit worried with your
remarks about using mm/dd/yyyy (which I know is better), but I pass one
of the date values to a variable which I will then use in the above
function instead of the "05/26/2004" literal date value. Will I
encounter problems? Can I easily change the format of the value of the
variable so that it becomes mm/dd/yyyy?

Many thanks,

Adrian


---
Message posted from http://www.ExcelForum.com/