Notifications
Announcements
I have a json response that contains a date in unix timestamp format, anyone know how to convert it?
I tried converttoutc but it throws errors and I cant save the expression.If that function doesnt work, anyone have a flow recipe to do this ? Is it possible ?
Hi @Binaryjam,
I have made a test on my side and I afraid that there is no any way to convert a unix timestamp to a utc date in microsoft flow currently.
Converting a unix timestamp to a utc date is not supported in microsoft flow.
I afraid that there is no way to achieve your needs in Microsoft Flow currently.
If you would like this feature to convert a unix timestamp to a utc date to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:
https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas
Best regards,
Alice
Hello, @Binaryjam! Have you had an opportunity to apply @v-yuazh-msft's recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!
Thank you for being an active member of the Flow Community! -GabrielFlow Community Manager
Yeh I reviewed it, its wrong, its totally possible to do this in flow, its just a bit of maths and thats all.
addseconds('1970-1-1', Div(timestamp,1000) , 'yyyy-MM-dd')
I figured it out eventually.
Any recommendations as to how you would then convert this into a different time zone?
Here is a good example I was able to make use of based on my timestamp:
"last_occurrence_timestamp": 1550573979
Convert this time to '2019-02-19 10:59:39' by using the following calculation
addseconds('1970-1-1', Div(triggerBody()?['data']?['item']?['last_occurrence_timestamp'],1),'yyyy-MM-dd hh:mm:ss')
Hi @cotton_gin1 ,
What Action do you use? I have a Unix timestamp as output from a Parse JSON Action but which Action do I use to convert using addseconds?
Thanks!
@ericonline,
It could be a Compose action to call this out for validation but you could use Set Variable as well. Any place where you are using Dynamic Content, you can switch to using an Expression.
Perfect, thank you!
Hi @cotton_gin1 .
Hm. I cannot seem to get this working using the recipe you provided (edited for my use case of course).
Can you identify what I'm missing?
Trigger: Button
Action1: HTTP RequestAction2: Parse JSON
{ "type": "FeatureCollection", "metadata": { "generated": 1557358894000, "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2019-05-07T00%3a00%3a00.0000000&endtime=5%2f8%2f2019&latitude=39.0422528&longitude=-95.6719104&maxradiuskm=1000&orderby=magnitude-asc", "title": "USGS Earthquakes", "status": 200, "api": "1.8.1", "count": 1 }, "features": [ { "type": "Feature", "properties": { "mag": 2.9, "place": "16km N of Snyder, Texas", "time": 1557260837307, "updated": 1557331308692, "tz": -360, "url": "https://earthquake.usgs.gov/earthquakes/eventpage/us70003i1i", "detail": "https://earthquake.usgs.gov/fdsnws/event/1/query?eventid=us70003i1i&format=geojson", "felt": 1, "cdi": 2.7, "mmi": null, "alert": null, "status": "reviewed", "tsunami": 0, "sig": 130, "net": "us", "code": "70003i1i", "ids": ",us70003i1i,", "sources": ",us,", "types": ",dyfi,geoserve,origin,phase-data,", "nst": null, "dmin": 0.028, "rms": 0.48, "gap": 36, "magType": "mb_lg", "type": "earthquake", "title": "M 2.9 - 16km N of Snyder, Texas" }, "geometry": { "type": "Point", "coordinates": [ -100.9142, 32.8648, 1.96 ] }, "id": "us70003i1i" } ] }
Action3: Apply to Each
**Your Recipe:** `addseconds('1970-1-1', Div(triggerBody()?['data']?['item']?['last_occurrence_timestamp'],1),'yyyy-MM-dd hh:mm:ss')` **Test 1:** `addseconds('1970-1-1', items('Apply_to_each')?['properties']?['time'],'yyyy-MM-dd hh:mm:ss')` **RESULTS:** `InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2590': 'Value to add was out of range. Parameter name: value'.` **Test 2:** `addseconds('1970-1-1', Div(items('Apply_to_each')?['properties']?['time'],1),'yyyy-MM-dd hh:mm:ss')` **RESULTS:** `InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2590': 'Value to add was out of range. Parameter name: value'.` **Test 3:** `addseconds('1970-1-1', item()?['properties']?['time'],'yyyy-MM-dd hh:mm:ss')` **RESULTS:** `InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2590': 'Value to add was out of range. Parameter name: value'.`
Any ideas? Thank you!
@ericonline
That time field listed in your JSON is different than the one I was using.
Change your formula to divide by 1000.
`addseconds('1970-1-1', Div(triggerBody()?['data']?['item']?['last_occurrence_timestamp'],1000),'yyyy-MM-dd hh:mm:ss')`
That should work.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 522 Super User 2025 Season 2
Tomac 364 Moderator
abm abm 243 Most Valuable Professional