DateConvert
Last updated
Was this helpful?
Converts local time to Coordinated Universal Time (UTC), or UTC to local time.
The function uses the daylight savings settings in the executing computer to compute daylight savings time, if required.
DateConvert(conversionType=[string], date=[any])conversionType
string
true
The conversion type. Valid values are "utc2Local" and "local2Utc".
date
any
true
The date to convert.
utc_datetime = dateConvert( "local2Utc", now() );
Result: {ts '2025-05-27 05:12:10'}
This example makes sense only if your server time is UTC. now() uses your server settings when creating a datetime object.
Result: {ts '2025-05-26 22:12:10'}
Last updated
Was this helpful?
Was this helpful?
local_datetime = dateConvert( "utc2Local", now() );
writeDump( DateConvert( "Local2utc", "{ts '2006-01-26 02:00:00'}" ) );
writeDump( DateConvert( "utc2Local", now() ) );
