05-30-2025, 10:29 PM
(This post was last modified: 05-30-2025, 10:35 PM by George Bleck.)
As simple as a call to GetSystemTime then format the response. But why here instead of PowerBASIC forums?
Code:
FUNCTION fn_GetCurrentTimeISO8601UTC() AS STRING
LOCAL v_udtST AS SYSTEMTIME
LOCAL v_strTimpstamp AS STRING
GETSYSTEMTIME v_udtST
FUNCTION = fn_SystemTimeToISO8601(v_udtST)
END FUNCTION
'----------------------------------------------------------------------------(')
FUNCTION fn_SystemTimeToISO8601(BYREF v_udtST AS SYSTEMTIME) AS STRING
FUNCTION = _
FORMAT$(v_udtST.wYear, "0000") & _
FORMAT$(v_udtST.wMonth, "00") & _
FORMAT$(v_udtST.wDay, "00") & _
"T" & _ _
FORMAT$(v_udtST.wHour, "00") & _
FORMAT$(v_udtST.wMinute, "00") & _
FORMAT$(v_udtST.wSecond, "00") & _
"Z"
END FUNCTION