Updated on 2025-12-04 GMT+08:00

Conversion Between Datetime Objects and Unix Timestamps

  • Processing functions
    • You are advised to use the dt_parse function to convert Unix timestamps to datetime strings.
    • The tz parameter in the e_set function converts a datetime object without a time zone to one with a time zone, or converts the original time zone to the target time zone.
  • Convert a Unix timestamp into a time string with a time zone.
    • Raw log
      {
          "time": 1562741899
      }
    • Processing rule
      e_set("new_time", dt_parse(v("time"), tz="Asia/Shanghai"))
    • Processing result
      {
      	"new_time": "2019-07-10 14:58:19+08:00",
      	"time": 1562741899
      }