Full Title: Converting UTC Date Time to UNIX Time With Power Automate
Category: #articles
Document Note: The text explains how to convert a UTC datetime to Unix time using Power Automate. Unix time is the number of seconds that have passed since 00:00:00 UTC on January 1, 1970. The solution involves a series of steps to calculate the elapsed time in seconds between the Unix epoch and the desired datetime.
Summary: The text explains how to convert a UTC datetime to Unix time using Power Automate. Unix time is the number of seconds that have passed since 00:00:00 UTC on January 1, 1970. The solution involves a series of steps to calculate the elapsed time in seconds between the Unix epoch and the desired datetime.
Unix time is a system for describing a point in time; it is the number of seconds that have elapsed since the Unix epoch, minus leap seconds. the Unix epoch is 00:00:00 UTC on 1 January 1970. Leap seconds are ignored with a leap second having the same Unix time as the second before it, and every day is treated as if it contains exactly 86400 seconds.
Since we know this, we just need to calculate how many seconds have passed between the Unix epoch and the datetime we want to convert. (View Highlight)
The solution is a single Compose action with the following expression:
div(sub(ticks(triggerBody()['text']),ticks('1970-01-01Z00:00:00')),10000000) (View Highlight)