Login  Register

Re: understanding the DateTime instance creation API

Posted by Paul DeBruicker on Jul 15, 2016; 8:23pm
URL: https://forum.world.st/understanding-the-DateTime-instance-creation-API-tp4906741p4906750.html

And just FWIW I'd switch the DateTime default printing to the ISO8601 string, and provide a default method to parse ISO8601 strings.


Paul DeBruicker wrote
Hi Dale,


I get


1@       -> anArray( 15/07/2016 10:10:10, 10, '2016-07-15T10:10:10+0000', )
2@       -> anArray( 15/07/2016 17:10:10, 17, '2016-07-15T17:10:10-0700', )

And I expect the last parameter of the second array to be '2016-07-15T10:10:10-0700'.   I'm not sure what the first should be. I think the first parameter is right because DateTimes are printed as UTC inside GemStone.  I think the #hour method which returns the hour in 'local' time should not be used in the ISO8601 string and instead a hourInTimeZone or somesuch should be used.  


I set the stone's timezone with:


printit
| osTZ |
System beginTransaction.
osTZ := TimeZone named:'UTC'.
osTZ installAsCurrentTimeZone.
TimeZone default: osTZ.
TimeZoneInfo default: osTZ.
System commitTransaction.
%

Both "TimeZone current"  and "TimeZone default" print 'UTC'.  


Paul







GLASS mailing list wrote
On 07/15/2016 12:37 PM, Paul DeBruicker via Glass wrote:
> Hi Dale,
>
> I pasted my testDt.st tode file below my name in my prior message.  If you
> run it you get two arrays with containing the DateTimes, their #hour, and
> the ISO8601 string.
>
haha, your message up to the signature fit exactly in the window in my
mail browser and didn't bother checking the scroll bar to see if there
was more:)

When I run your code I get the following:

1@       -> anArray( 15/07/2016 03:10:10, 3, '2016-07-15T03:10:10+0000')
2@       -> anArray( 15/07/2016 10:10:10, 10, '2016-07-15T10:10:10-0700')

Which I think is what you are expecting ... so there must be something
else going on? What is the timeZone for the machine that your stone is
run on?

Presumably this is where the bug is asserting itself ...

Dale

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass