Print real EPOCH timestamp in debug log

Hello,

In a pipeline rule i’m trying to log the time in EPOCH timestamp format, like “1644488094000”

I tried this, and many more :sweat_smile:

  let date = parse_date(to_string($message.timestamp), "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
  let final = to_double(date);
  debug(date);

But i still get the date into a human readable format :
2022-02-10T11:56:31.095+01:00 INFO [Function] PIPELINE DEBUG: 2022-02-10T10:56:31.094Z

Any idea how to achieve this ?

Thanks

I found the answer :

let date = parse_date(to_string($message.timestamp), "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
debug(date.Millis);

The documentation on «parse_date» must be improved as the parse_date object returned is not explained.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.