I have an HTTP webhook that I post to that requires me to send the event date in UNIX Timestamp. I'd like a function (like I use utcnow() for several flows) or a connector that can do that.
Your idea is good, Flow should support UNIX/Epoch Timestamps.
In the meantime, suggest you look at this solution to accomplish your task:
This should work:
Ticks are in units of 100 nanoseconds... so divide by 10000000 to get seconds.
@joelblogs idea almost works. It should be ticks x 10,000 and I'd use utcNow for current time so, this will work:
@MrBizDevOps Doesn't that depend upon if you want your timestamp in seconds, milliseconds or microseconds? ticks() returns nanoseconds, which you need to divide by 10^9 to convert to seconds.
My answer gave timestamp in seconds. Doesn't yours give it in microseconds?
There are several formats of UNIX timestamp, including the above three. Seconds is the most used format though.
This should still be the most common right answer... and has been working for me 😉
@joelblogs good points of clarification! I followed another thread to get here where they were looking for milliseconds using https://currentmillis.com/ but in all the link jumping, I didn't realize this post was not as specific!
I think that as long as users understand that depending on their need, they can get the right UTC time in seconds, milli, etc by changing the multiplier, this addresses the need. In APM tools like Dynatrace for example, because they focus on crunching data for events tracked down to the millisecond, the standard (and required) there is UTCmilli.
@joelblogs, thanks so much! This is a nice, clear and helpful solution.