Azure Logic App | Liquid

Abhay Chandramouli 966 Reputation points

I want to convert a given utcNow() time stamp in logic apps liquid transformation to unix timestamp like 1666861645116.

Please help me do this with liquid example code

Thanks in advance

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

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,856 Reputation points Microsoft Employee

    Since the ticks() function isn't available in Liquid, you can try using date filter to convert; {{ 'now' | date: '%s%N' }}. If that doesn't work, you could try doing your own function

    # Convert a UTC timestamp to ticks
    # Usage: {{ '2022-01-01T00:00:00Z' | to_ticks }}
    # Note: This filter assumes that the input timestamp is in UTC format.
    module ToTicksFilter
      def to_ticks(input)
        Time.parse(input).to_i * 10_000_000 + 62_135_596_800_000_000

    where the usage would be {{ '2022-01-01T00:00:00Z' | to_ticks }}.

    1 person found this answer helpful.
    0 comments No comments