Skip to content

unix_timestamp_parse function ​

The unix_timestamp_parse function converts a Unix timestamp, in seconds, into an object with its date and time values in Coordinated Universal Time (UTC).

hcl
unix_timestamp_parse(UNIX_TIMESTAMP)

The function requires a whole number that fits in a signed 64-bit integer.

Example ​

hcl
locals {
  timestamp = unix_timestamp_parse(1690328596)
  rfc3339  = local.timestamp.rfc3339
}

The result includes the following attributes:

AttributeDescription
yearCalendar year.
year_dayDay of the year.
monthMonth number.
month_nameFull month name.
dayDay of the month.
weekdayDay of the week, where Sunday is 0.
weekday_nameFull weekday name.
hourHour in 24-hour time.
minuteMinute of the hour.
secondSecond of the minute.
rfc3339RFC 3339 timestamp string.
iso_yearISO 8601 week-numbering year.
iso_weekISO 8601 week number.
  • rfc3339_parse converts an RFC 3339 timestamp into date and time values.
  • formatdate formats an RFC 3339 timestamp string.

Released under the MPL-2.0 License.