Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Json weird date format
Message
 
To
02/10/2020 19:40:15
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
01676446
Message ID:
01676664
Views:
57
This message has been marked as the solution to the initial question of the thread.
Likes (1)
It's an old Microsoft specific format. They used this for various service implementation (WCF REST) and the ASP.NET based ASHX and Page services). The value is a JavaScript data ticks since 1970.

I have code to parse this as part in wwJsonSerializer (which handles this automatically). Here's the relevant bit (you can remove the GetTimeZone() and do that conversion on your own after you get the final date - the date will be UTC).
*** MS AJAX Date Format: "\/Date(1012341)\/"
IF lcDate = ["\/] OR lcDate = ["\\/]
   lnMSecs = VAL(STREXTRACT(lcDate,"Date(",")"))
   RETURN {^1970/01/01 0:0} - (GetTimeZone() * 60) +  (lnMSecs/1000) 
ENDIF
+++ Rick ---

>Hi, Im developing a small interface between and VFP9 desktop application and a web service. This WS needs to send it some data en Json format, 95% of the data can be generated without problems, but some date data require a weird format. Below is an example
>
>/Date(1579669200000-0500)/
>
>I googled and couldn't find anything that can generate that weird format using VFP.
>
>Any suggestions.
>
>TIA
>
>Luis
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform