Forum Discussion

JoelHickok's avatar
JoelHickok
Qrew Cadet
2 years ago

Format Iso String Timestamp in Pipeline

I'm making a request to the Quickbase JSON API and getting the results to use in the next Pipeline step.  I can see the field type is "timestamp" and the value is an iso date timestamp, such as "2022-10-12T17:26:42Z".  I cannot seem to format this into a readable date/time string to send in an email, or use in another step.

There are no Jinja filters that seem to work, as the Quickbase flavor of Jinja is so limited.
I cannot us strftime because it's not a date, but a text string.  There are other platforms and documentation for Jinja that refer to a filter such as: iso8601_to_time

For example:  (this would be great in QB Pipelines!)
{{ iso_date|iso8601_to_time|datetimeformat('%a, %B %d') }}
Any ideas?  Thanks!

------------------------------
Joel Hickok
------------------------------

3 Replies

  • I'm still looking for a solution for how to work with the ISO 8601 format in a Pipeline using Jinja, but for now I am just falling back on another solution.  My alternative is to create a Formula field in the same table, and use a Formula to format the date timestamp as text.  Then the Pipeline can access the text field and use that in the Jinja template for sending emails, etc.

    ------------------------------
    Joel Hickok
    ------------------------------
    • DougHenning1's avatar
      DougHenning1
      Community Manager
      You can use time.parse() to convert the string to a datetime object then format it:

      {{ time.parse("2022-10-12T17:26:42Z").strftime("%a, %B %d") }}

      Returns:  Wed, October 12

      Hope that helps!

      ------------------------------
      Doug Henning
      ------------------------------
      • JoelHickok's avatar
        JoelHickok
        Qrew Cadet
        Doug... you nailed it.  Thank you!

        time.parse() to the rescue.

        The problem with Pipelines and Jinja is knowing which modules are available within the Jinja template language inside a Pipeline, as well as what filters are available versus inaccessible.  I tried working with datetime, etc., but just never got around to time.  I wish Quickbase had documentation that cast a wider net over what is possible.  But this is a tricky task to document another language as it used in your environment.

        As a side note, it does also work very well to have another field in your QB table that does any formatting for you, as you can leverage any of those features too.  But I like to keep all my logic in the same place.

        ------------------------------
        Joel Hickok
        ------------------------------