Code: Select all
Structure tm
tm_sec.l; // seconds after the minute - [0, 60] including leap second
tm_min.l; // minutes after the hour - [0, 59]
tm_hour.l; // hours since midnight - [0, 23]
tm_mday.l; // day of the month - [1, 31]
tm_mon.l; // months since January - [0, 11]
tm_year.l; // years since 1900
tm_wday.l; // days since Sunday - [0, 6]
tm_yday.l; // days since January 1 - [0, 365]
tm_isdst.l; // daylight savings time flag
EndStructure
ImportC ""
time(*tm)
gmtime(t.i)
EndImport
Procedure.s UTC()
Protected time.tm,*time.tm,date.s,day.s
time(@time)
*time = gmtime(@time)
Select *time\tm_wday
Case 0
day = "Sunday"
Case 1
day = "Monday"
Case 2
day = "Tuesday"
Case 3
day = "Wednesday"
Case 4
day = "Thursday"
Case 5
day = "Friday"
Case 6
day = "Saturday"
EndSelect
date + Day + ", " + RSet(Str(*time\tm_mday),2,"0") + " " + RSet(Str(1 + *time\tm_mon),2,"0") + " " + Str(1900 + *time\tm_year) + " " + RSet(Str(*time\tm_hour),2,"0") + ":" + RSet(Str(*time\tm_min),2,"0") + ":" + RSet(Str(*time\tm_sec),2,"0") + " UTC"
ProcedureReturn date
EndProcedure
Debug UTC()