Показать сообщение отдельно
Старый 04.07.2019, 11:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsnavax: Business Events and Date format in Flow
Источник: http://dynamicsnavax.blogspot.com/20...t-in-flow.html
==============

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".


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...atesInJSON.htm

If you have a better way of handling dates. Please let me know.


Источник: http://dynamicsnavax.blogspot.com/20...t-in-flow.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.