Skip to main content
Question

Jinja ISO Date format in Pipeline

  • January 16, 2023
  • 0 replies
  • 1059 views

Hey experts,

I am trying to use the value of a field (Date/Time or Date field) in a Pipeline to be sent to a webhook.  I need to output an ISO date but can't figure out how to convert it to the right format.

Currently I'm getting: 2023-01-16 15:59:19.671000+00:00
I need: 2023-01-16T15:59:19.671Z

Is there a Jinja function or something I can use to make this conversion?



------------------------------
Jeremy Lahners
LeadBaller
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+6
You can use strftime to specify the formatting. This should do the trick:

{{ time.now.strftime("%FT%T.%f")[:-3] ~ "Z" }}​

%F date formatted as "YYYY-MM-DD"
T Literal character
%T time in 24 hour format
[:-3] strips the last three characters from the end
~ "Z" appends the letter Z to the end

------------------------------
Doug Henning
------------------------------