Business Events formats Dates in the Microsoft JSON format, e.g. "EventTime": "/Date(1560839609000)/"
I wish it was in ISO8601 standard e.g. "2019-06-18T05:40Z".
I wish it was in ISO8601 standard e.g. "2019-06-18T05:40Z".
Below is what I did using Flow.
First get the integer part of the string by using the replace function.
Function: int(replace(replace('/Date(1560839609000)/','/Date(',''), ')/', ''))
Output: 1560839609000
To format into date.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd')
Output: 2019-06-18
To format into datetime.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd hh:mm:ss')
Output: 2019-06-18 06:33:29
Using an online converter I am able to validate my output.
https://www.epochconverter.com/
After that, you can use the Date Time string to or formatDateTime function.
For the developers out there. Newtonsoft is great for working with dates and supports both formats. Have a look at this link for a bit more info.
https://www.newtonsoft.com/json/help/html/DatesInJSON.htm
If you have a better way of handling dates. Please let me know.
First get the integer part of the string by using the replace function.
Function: int(replace(replace('/Date(1560839609000)/','/Date(',''), ')/', ''))
Output: 1560839609000
To format into date.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd')
Output: 2019-06-18
To format into datetime.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd hh:mm:ss')
Output: 2019-06-18 06:33:29
Using an online converter I am able to validate my output.
https://www.epochconverter.com/
After that, you can use the Date Time string to or formatDateTime function.
For the developers out there. Newtonsoft is great for working with dates and supports both formats. Have a look at this link for a bit more info.
https://www.newtonsoft.com/json/help/html/DatesInJSON.htm
If you have a better way of handling dates. Please let me know.