![]() |
Getting Current UTC - Printable Version +- PowerBASIC Users Meeting Point (http://pump.richheimer.de) +-- Forum: User to User Discussions (http://pump.richheimer.de/forumdisplay.php?fid=3) +--- Forum: PowerBASIC for Windows (http://pump.richheimer.de/forumdisplay.php?fid=4) +--- Thread: Getting Current UTC (/showthread.php?tid=51) |
Getting Current UTC - Owen_English - 05-30-2025 Have waded back thru the previous forum posts but at a loss to get an answer. Sorry if it's been asked before but all I need is the numerical string for the Current UTC timestamp. How? Thanks. RE: Getting Current UTC - Kurt Kuzba - 05-30-2025 Do you mean getting it from the NOWUTC in PowerTime? TimeStringFull? Or how to get it from the web? RE: Getting Current UTC - Owen_English - 05-30-2025 (05-30-2025, 11:32 AM)Kurt Kuzba Wrote: Do you mean getting it from the NOWUTC in PowerTime? TimeStringFull?Thanks Kurt, not web. Just need the UTC as a string to log events against and to keep a note of elapsed time. Trying to keep it simple! RE: Getting Current UTC - Albert Richheimer - 05-30-2025 (05-30-2025, 06:22 AM)Owen_English Wrote: Sorry if it's been asked before but all I need is the numerical string for the Current UTC timestamp. You might want to have a look at the PowerTime Object. RE: Getting Current UTC - Owen_English - 05-30-2025 Yes, am looking at that, seems as tho needs 20-30 lines of code to get the UTC 'now' string and just wondered if there was a simpler way of doing it. RE: Getting Current UTC - Dale Yarker - 05-30-2025 Do you have PBWin 10.0x for PowerTime? " Just need the UTC as a string to log events against and to keep a note of elapsed time." To do arithmetic in time (like elapsed) get/keep the stamp in PowerTime (AKA QUAD or FileTime), then convert to text number for display or print. For older PB versions the API functions are not hard to do. Cheers, we cross posted on last. 30 lines? Where is that? Looks closer to 4 lines at a quick glance: NOW TIMEDIFF DATESTRING TIMESTRINGFULL RE: Getting Current UTC - George Bleck - 05-30-2025 As simple as a call to GetSystemTime then format the response. But why here instead of PowerBASIC forums? Code: FUNCTION fn_GetCurrentTimeISO8601UTC() AS STRING |