.netliquidazure-logic-appsdotliquid

How to add time with Liquid templates in Azure Logic Apps?


I'm trying to add a specific duration to a particular datetime field in my JSON to JSON Transform input Content, using methods as demonstrated in this answer. However, logic apps use dotliquid internally, the default config of which uses .NET date format strings instead of Ruby's.

I could find no available .NET date format alternative for Ruby's %s (returns the number of seconds since the Unix epoch) which is essential to the operation.


Solution

  • Example to add 6 hours and 30 minutes from now and format :

    {
      "outputKey" : {{ "now" | Date: "yyyy-MM-ddThh:mm:ss" | Append: "-06:30" | Date: "yyyy-MM-ddThh:mm:ss"}}
    }