DateAndTime dayOfWeek seems off by the offset from GMT.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DateAndTime dayOfWeek seems off by the offset from GMT.

Paul DeBruicker
If I run:

(DateAndTime now + 8 hours ) dayOfWeekName

right now (approx. 9:50 AM PST) in a workspace on a GLASS system where
the localTimeZone is PST the result is 'Wednesday'.  From reading the
comments of the dayOfWeekName method in DateAndTimeANSI I think it
should be 'Tuesday' as it should be given in the local time zone.

Is this a bug I should create an issue for or a misunderstanding of how
it operates on my part?

Thanks


Paul
Reply | Threaded
Open this post in threaded view
|

Re: DateAndTime dayOfWeek seems off by the offset from GMT.

James Foster-8
Paul,

Thanks for the report; this is a bug. The problem is that DateAndTime>>#'dayOfWeek' is not applying the local time offset. Fix the code by adding the internal offset to the seconds:

        ^seconds + offset // 60 // 60 // 24 + 1 \\ 7 + 1  "1 January 2001 was a Monday"

I'll enter a GemStone bug and apply the fix.

James


On Jul 20, 2010, at 9:54 AM, Paul DeBruicker wrote:

> If I run:
>
> (DateAndTime now + 8 hours ) dayOfWeekName
>
> right now (approx. 9:50 AM PST) in a workspace on a GLASS system where
> the localTimeZone is PST the result is 'Wednesday'.  From reading the
> comments of the dayOfWeekName method in DateAndTimeANSI I think it
> should be 'Tuesday' as it should be given in the local time zone.
>
> Is this a bug I should create an issue for or a misunderstanding of how
> it operates on my part?
>
> Thanks
>
>
> Paul