cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rohitjadhav123
Helper IV
Helper IV

How to convert UTCString date to yyyy-MM-dd formate using formatdatetime()

I have date returned by http service in following format

 

[
{
"item": "Laptop",
"manufacturer": "Dell",
"model": "Latitude",
"tag": "123",
"primaryUsage": "Primary",
"contractEndDate": 1481241600000

}
]

 

I would like to format this date into something readable date like yyyy-MM-dd. So in My Power Automate / Flow I see there is function called formatdatetime() which can be used.

 

Howe ever, this function needs date in 'ISO 8601 timestamp string'. It does not take something like what i have above ( 1481241600000 )

 

Is there is way I can convert 1481241600000 date into ISO 8601 so I can use formatdatetime() easily?

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
sayyedkohler
Helper III
Helper III

I was facing same issue while using Excel as a data source (In Excel we entered date, while in flow that was showing number only).
Using that code I was able to get exact date:

addDays('1899-12-30', int(outputs('DatePurchase')), 'yyyy-MM-dd')

 You need to replace outputs('DatePuchase') with your data.

Thanks

View solution in original post

v-LilyW-msft
Community Support
Community Support

Hi @rohitjadhav123 

Please take a try to use this Expression to convert a Unix Timetamp to a UTC date.

addseconds('1970-1-1',Div(outputs('Compose'),1000),'yyyy-MM-dd')
vLilyWmsft_0-1633590429040.png
vLilyWmsft_0-1633590752594.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
sayyedkohler
Helper III
Helper III

I was facing same issue while using Excel as a data source (In Excel we entered date, while in flow that was showing number only).
Using that code I was able to get exact date:

addDays('1899-12-30', int(outputs('DatePurchase')), 'yyyy-MM-dd')

 You need to replace outputs('DatePuchase') with your data.

Thanks

View solution in original post

v-LilyW-msft
Community Support
Community Support

Hi @rohitjadhav123 

Please take a try to use this Expression to convert a Unix Timetamp to a UTC date.

addseconds('1970-1-1',Div(outputs('Compose'),1000),'yyyy-MM-dd')
vLilyWmsft_0-1633590429040.png
vLilyWmsft_0-1633590752594.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,472)