Need DateTime format in Liquid template

Revathi Subramaniam 21 Reputation points
2020-10-10T13:52:12.163+00:00

Hi,

I need to convert datetime format as "yyyy-MM-dd'T'HH:mm:ss.fff'Z'" from this date format "2020-09-14T12:00:00+0000.

But when i convert in liquid template from json to json using this "yyyy-MM-dd'T'HH:mm:ss.fff'Z'" syntax. am always getting 2019-01-01T12:00:00Z this one as output always.Here milliseconds is not coming. i need to get ouput like this 2019-01-01T12:00:00.000Z.

could anyone help on this please

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,838 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MayankBargali-MSFT 68,396 Reputation points
    2020-10-12T07:58:36.637+00:00

    Hi @Revathi Subramaniam

    I don't see a way to achieve it using a liquid template. Logic app liquid leverages the opensource dotliquid where you can also contribute. Looking into the source code I don't see a way to achieve your result using DotLiquid as it is a limitation from their end.

    Alternately, to convert the string to your desire format you can try to use inline code by writing your own code to achieve the desired result.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

  2. Rakesh Khanna 1 Reputation point
    2021-03-17T17:01:38.973+00:00

    If you look at the source code for dotliquid it does formats the date with code DateTime.ToString(format). this format takes in the string and you can provide the desired format as in normal .net class. Just add

    "desiredDate": "{{DesiredDate | date:"yyyy-MM-dd HH:mm:ss.fffZ"}}",`  
    

    and it will give you the milliseconds in results.

    0 comments No comments