Holger's Thoughts on Delphi

Monday, May 15, 2006

ECO: DateTime values in OCL

Today, Jonas Högström posted an excellent summary how to specify DateTime-values in OCL. He also commented on the effect different timezones have on it. A lot of people browse blogs first and thus I repost it here.

The question came from Dmitriy Nagirnyak, a regular in the public newsgroup about ECO.
Could somebody please explain the correct way for writing OCL with DateTime. [?]

These are the literals that OCL accepts:

Date: #yyyy-mm-dd
Time: #hh:mm:ss
Time: #hh:mm
DateTime: #yyyy-mm-ddThh:mm:ss
DateTime: #yyyy-mm-ddThh:mm

It is independent of culture, religion, dst, timezone and any other
setting that might vary on your computer. The Time literals will return a TimeSpan value. There is unfortunately
no way to specify "days" in this literal...

It will [be] - on second thought- in the current timezone and current DST.
DateTimeFormat however has no influence ofer the parsing of the literal.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home