Azure Logic Apps

Abhay Chandramouli 1,021 Reputation points
2023-05-01T12:29:32.89+00:00

Hi,

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

Please let me know an expression to do this .. I am unable to achieve the same using liquid's "now" function.

Please let me know how to do this using logic apps expressions or liquid methods (which are acceptable by logic apps)

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

Accepted answer
  1. RevelinoB 2,780 Reputation points
    2023-05-01T13:03:09.4233333+00:00

    Hi Abhay, To convert the current UTC time in Logic Apps to a Unix timestamp, you can use the following expression:

    "@div(sub(ticks(utcNow()), ticks('1970-01-01T00:00:00Z')), 10000)"

    • utcNow() should retrieve the current UTC time.
    • ticks('1970-01-01T00:00:00Z') gives the Unix epoch start time.
    • sub(ticks(utcNow()), ticks('1970-01-01T00:00:00Z')) calculates the difference between the current time and the epoch start time in ticks.
    • div(..., 10000) divides the tick difference by 10,000 to convert it to milliseconds (Unix timestamp format).

    The summarize this expression will give you the Unix timestamp in milliseconds.

    I hope this helps?

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.