SESSION:TIMEZONE not being used by DATETIME-TZ

JamesBowen

19+ years progress programming and still learning.
The TIMEZONE-TZ function is not using the SESSION:TIMEZONE but rather the SESSION:TIME-SOURCE.

The documentation says for the timezone-exp parameter:
An expression whose value is an integer representing the time zone offset from Coordinated Universal Time (UTC) in minutes. If not specified, the function uses the session's time zone.

Sample code will prove my point.

Code:
def var dateTime-tz as datetime-tz no-undo.
def var dateTime-UTC as datetime-tz no-undo.

/** Set the SESSION TimeZone to be +10 hours ahead of UTC.**/
SESSION:TIMEZONE = 600. /** +10:00 **/

/*
An expression whose value is an integer
representing the time zone offset from
Coordinated Universal Time (UTC) in minutes.
If not specified, the function uses the "session's time zone".
*/

dateTime-tz  = DATETIME-TZ(today, mtime ).  /** No time zone specified. **Should use SESSING TIMEZONE!** **/
dateTime-UTC = DATETIME-TZ(dateTime-tz, 0). /** Convert the local time to UTC **/


IF SESSION:TIMEZONE NE TIMEZONE(dateTime-tz) THEN
 MESSAGE SESSION:TIMEZONE  " != "  TIMEZONE(dateTime-tz) SKIP
        SESSION:TIME-SOURCE
    VIEW-AS ALERT-BOX ERROR TITLE "TimeZone Not MATCHING???".

message
    ISO-DATE(dateTime-tz) SKIP
    ISO-DATE(dateTime-UTC)
    view-as alert-box info.
 
Found the problem. Needed to include a client start-up parameter -useSessionTZ 1
 
Last edited:
Back
Top