Issue with Date/Time Functions

None whatsoever. Just saw a bunch of stuff relating to DST, and had the overwhelming urge to spew knowledge and/or fallacy. Sometimes I just can’t help myself!

Nicely worded response, by the way. Very tactful. :stuck_out_tongue:

Sure, but what happens in the reverse case? Where it is June 1st and you are calculating the date for December 30.

In one case the effective time of TIME(Y,M,D)-GMTOFFSET() will be 1:00am and in the other it will be 11pm the previous day.

OK, that is a good point.
Does KM have a function/token that will identify when DST is in effect?

Here is perhaps one way:

--- SHOW DAYLIGHT OR STANDARD TIME ---
ICUDateTime%zzzz%
Central Standard Time

According to the Formatting Dates and Times - ICU User Guide
"zzzz" produces "Pacific Daylight Time"

So we could test for "Daylight" in the current date, and add an extra hour to the formula.

OR, just always add an extra hour.

I guess this is now getting complicated enough that if all the user is interested in is the date, and not the time, then your suggestion of setting the date for noon is the simplest approach:

--- SET DATE FOR NOON ---
ICUDateTimeFor%TIME(2016,06,01, 12,0,0)%EEE, MMM d, yyyy h:mm a%
Wed, Jun 1, 2016 7:00 AM

It just feels like a kludge. :wink:
But sometimes a kludge is the best thing to do.

1 Like

No. I'm not sure if the system provides any such method. Really GMTOFFSET should itself take a time - but then technically it would have to know where you were at that time too.

Yes, that was my other suggestion, simply do:

TIME(Y,M,D)-GMTOFFSET()+3*3600

which should give a safely small but positive time into the specified day in the local timezone.

Your call whether that is better or worse than

TIME(Y,M,D,12,0,0)