gmtime
datetimeConverts a timestamp to GMT/UTC timezone
Syntax
gmtime(timestamp) Parameters
timestamp (timestamp) The timestamp to convert to GMT/UTC
Returns
timestamp The timestamp adjusted to GMT/UTC
Examples
Convert local time to UTC
Input:
gmtime("2024-01-15 09:30:00") Output:
"2024-01-15 14:30:00" Normalize to UTC
Input:
.local_timestamp | gmtime Output:
Convert local field to UTC Create UTC versions
Input:
map({utc_time: .timestamp | gmtime}) Output:
Add UTC time field The gmtime() function converts a timestamp from local time to GMT/UTC, adjusting the time value to Universal Coordinated Time.
Usage
Use gmtime() to normalize timestamps to UTC, prepare data for storage in UTC format, or convert local times for consistent time comparisons across timezones.