"configure Powerserver to log using Local time"
" Powerserver is returning session info"
are you talking about the api returning session info, or logging events in the server's event log? I assume the hosting system is responsible for how the time is logged/displayed?
IMO, the api returning time in UTC makes sense. At least for me, using powerserver means multiple time zones so UTC/GMT makes sense. Plus , it is standard for webapis to return time in UTC.
just wish we had native PB functionality to convert UTC and local because of things like this. Multiple functions would be needed: UTCToLocal and converttotimezone.
and then, maybe one day in the future, support this stuff in datawindows. in the future when we have flying cars and robots to do the cleaning. which means appeon would need to start on this right away.
Here is some code that Rene provided:
here is an example for converting UTC to local time using Windows API.
(For conversion to UTC see function TzSpecificLocalTimeToSystemTime)
// external functions
protected Function boolean GetTimeZoneInformationForYear &
(uint year, &
char tz, &
ref os_time_zone_information lpTimeZoneInformation) Library "kernel32"
protected Function boolean SystemTimeToTzSpecificLocalTime &
(os_time_zone_information lpTimeZone, &
os_systemtime lpUniversalTime, &
ref os_systemtime lpLocalTime ) Library "kernel32"
// structures
type os_systemtime from structure
unsignedinteger wyear
unsignedinteger wmonth
unsignedinteger wdayofweek
unsignedinteger wday
unsignedinteger whour
unsignedinteger wminute
unsignedinteger wsecond
unsignedinteger wmilliseconds
end type
type os_time_zone_information from structure
long bias
integer standardname[32]
os_systemtime standarddate
long standardbias
integer daylightname[32]
os_systemtime daylightdate
long daylightbias
end type
// function datetime of_utc2local (datetime adtm_utc)
datetime ldtm_local
os_time_zone_information lstr_tzi
os_systemtime lstr_utc
os_systemtime lstr_local
char lc_c
boolean lb_rc
SetNull (ldtm_local)
//local time zone
lb_rc = GetTimeZoneInformationForYear (Year(Date(adtm_utc)), lc_c, lstr_tzi)
IF NOT lb_rc THEN return ldtm_local
//PowerBuilder datetime -> SYSTEMTIME (for UTC)
lstr_UTC.wYear = Year(Date(adtm_utc))
lstr_UTC.wMonth = Month(Date(adtm_utc))
lstr_UTC.wDay = Day(Date(adtm_utc))
lstr_UTC.wHour = Hour(Time(adtm_utc))
lstr_UTC.wMinute = Minute(Time(adtm_utc))
lstr_UTC.wSecond = Second(Time(adtm_utc))
lstr_UTC.wMilliseconds = 0
//Convert to local time zone
lb_rc = SystemTimeToTzSpecificLocalTime (lstr_tzi, lstr_UTC, lstr_local)
IF NOT lb_rc THEN return ldtm_local
//Convert SYSTEMTIME to PowerBuilder datetime
ldtm_local = DateTime (Date (lstr_local.wYear, lstr_local.wMonth, lstr_local.wDay), &
Time (lstr_local.wHour, lstr_local.wMinute, lstr_local.wSecond))
return ldtm_local