PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Date Format "YYYY-MM-DDTHH:mm:SS.CC +10:00"
Date Format "YYYY-MM-DDTHH:mm:SS.CC +10:00"
Iniciado por guest, 16,jun. 2016 10:52 - 3 respuestas
Publicado el 16,junio 2016 - 10:52
Hi All

Have to create a string from local date relative to UTC \ GMT showing the number of hours difference.
eg 2016-07-31T15:20:20.00+10:00 where the "+10:00" is based on time zone affected by daylight saving.

DateToString(SysDateTime(),"YYYY-MM-DDTHH:mm:SS.CC +") + <the number of hours ahead or behind GMT. New Zealand time zone

Any pointers appreciated.

Thanks Mark
Publicado el 16,junio 2016 - 13:10
Hi Mark

if your problem is to find the number of hours of difference, you can use DateTimeLocalToUTC to get the UTC date time, then you use datetimedifference on the 2 values

Best regards
Publicado el 16,junio 2016 - 13:39
Hi Mark

Try this:

sTimeLocal is string
sTimeUTC is string
sUTCDifference is string

sTimeLocal=SysDateTime()
sTimeUTC=DateTimeLocalToUTC(sTimeLocal)
sUTCDifference = DateTimeDifference(sTimeLocal, sTimeUTC)
trace(DateToString(sTimeLocal,"YYYY-MM-DDTHH:mm:SS.CC") + " UTC"+left(sUTCDifference,1)+timeToString(right(sUTCDifference,8), "HH:MM") )

HTH

King
Publicado el 16,junio 2016 - 21:18
Hi Fabrice and King

Thanks for the responses. Especially the code. Worked perfectly. Much appreciated.

Mark