I have a date string, say “11/03/2008 09:33:00 AM”. When I use @ToTime, the value is returned unchanged as a date/time. However, if I use @Date on this string, I get a date of “10/03/2008”. @Time returns a time of “08:33:00 AM”. What is going on? How can I just get a date part value that is the same as what I put in!
Subject: @Date and @Time woes
There is no timezone information in the string? Not that I know of a timezone that is 25 hours earlier?
Date and time right on your computer?
Subject: @Date and @Time woes
@ToTime is intended as a type-safe conversion to a date/time value, “type-safe” meaning that if the value is already a date/time (as opposed to text), no error occurs. It is a partial replacement for the older @TextToTime. Do not confuse either of these functions with @Date (which returns a date-only date/time value from either a date/time or numbers) or @Time (which returns a time-only date/time value from either a date/time or numbers).
As for the hour difference (and it very likely is a one-hour difference), I’d be willing to bet that it’s a DST issue. Remember, the value stored for a date/time is just a number – and it appears (in this case) that the number is being truncated without regard for a DST adjustment. Try it with a date and time prior to the DST switch, just to see, and again with a date in May or June (well into the older DST range). You may have found a bug, or may have discovered a config problem in your own system.
Subject: @Date and @Time woes
@Text(@TextToTime(“11/03/2008 09:33:00 AM”) ; “S0”) - get the date value in string format
@Text(@TextToTime(“11/03/2008 09:33:00 AM”) ; “S1”) - get the tme value in string format
Subject: RE: @Date and @Time woes
The formatting function above returns the same values as in my original post. The server timezone is set to the same as the desktop and the time and date of both machines is the same. I think what is happening is an hour is being subtracted from the value by both functions. The @Date returns the previous day, because the time is set to 12:00:00 AM. However, this still leaves me with the same problem. Why are the functions modifying the supplied values?
Subject: Resolved
I found that the although both machine’s have the same timezone setting, the desktop is using ADT, while the server is on AST. Chile has extended DST this year until the end of the month and for some reason the server configuration was not updated correctly. Modifying the DST parameters on the server fixed the discrepancy.
Subject: RE: Resolved
So the difference in a day was just a typo??
Subject: RE: Resolved
Oh, I see. Completely missed that.
Subject: RE: Resolved
No, it was the hour’s difference between the two time zones. See my response above.
Subject: RE: Resolved
No, not a typo. The time component of the date was set to 12:00 AM, so when it subtracted an hour it wrapped to the previous date.