Getting Current UTC
#7
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
Reply


Messages In This Thread
Getting Current UTC - by Owen_English - 05-30-2025, 06:22 AM
RE: Getting Current UTC - by Kurt Kuzba - 05-30-2025, 11:32 AM
RE: Getting Current UTC - by Owen_English - 05-30-2025, 11:45 AM
RE: Getting Current UTC - by Albert Richheimer - 05-30-2025, 11:54 AM
RE: Getting Current UTC - by Owen_English - 05-30-2025, 11:58 AM
RE: Getting Current UTC - by Dale Yarker - 05-30-2025, 12:09 PM
RE: Getting Current UTC - by George Bleck - 05-30-2025, 10:29 PM

Forum Jump:


Users browsing this thread: