[
{
"Date": "\/Date(1316404800000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "\/Date(1316923200000)\/",
"Range": "Sep19-Sep25"
},
{
"Date": "\/Date(1316491200000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "\/Date(1317009600000)\/",
"Range": "Sep20-Sep26"
},
{
"Date": "\/Date(1316577600000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "\/Date(1317096000000)\/",
"Range": "Sep21-Sep27"
},
{
"Date": "\/Date(1316664000000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Thu",
"EndDate": "\/Date(1317182400000)\/",
"Range": "Sep22-Sep28"
},
{
"Date": "\/Date(1316750400000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Fri",
"EndDate": "\/Date(1317268800000)\/",
"Range": "Sep23-Sep29"
},
{
"Date": "\/Date(1316836800000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sat",
"EndDate": "\/Date(1317355200000)\/",
"Range": "Sep24-Sep30"
},
{
"Date": "\/Date(1316923200000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sun",
"EndDate": "\/Date(1317441600000)\/",
"Range": "Sep25-Oct01"
},
{
"Date": "\/Date(1317009600000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "\/Date(1317528000000)\/",
"Range": "Sep26-Oct02"
},
{
"Date": "\/Date(1317096000000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "\/Date(1317614400000)\/",
"Range": "Sep27-Oct03"
},
{
"Date": "\/Date(1317182400000)\/",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "\/Date(1317700800000)\/",
"Range": "Sep28-Oct04"
}
]
Is this a standard Date format in JSON?
"\/Date(1316404800000)\/"
I expanded dmjGetType() to return UTC or Time_t when it thinks it matches that format.
2012-04-23T18:25:43.511Z
/Date(1316404800000)/
The JSON RFC recommends using ISO rules for date representation. RFC requirement words have specific meanings. In the case of RECOMMENDED:
The RFC for RFCs states:
This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.
wow, same as CDC rules about masks.
The JSON text with the date & time value "\/Date(1316404800000)\/" is a legacy format used by Microsoft prior to .NET their adoption of ISO 8601.
https://www.newtonsoft.com/json/help/html/DatesInJSON.htm
https://davidsekar.com/javascript/converting-json-date-string-date-to-date-object
If the assumption is that the date & time value in the JSON example is a time_t value with millisecond precision, then the following snippet of c# should convert it:
If the assumption is that the date & time value in the JSON example is a time_t value with millisecond precision, then the following snippet of c# should convert it:
var datetime1 = DATETIME.new(1970,1,1).AddMilliseconds(131640480000)
Which gives a DATETIME value of "Monday, March 4, 1974 2:48:00 PM".
The online time_t converter site, https://www.onlineconversion.com/unix_time.htm (https://www.onlineconversion.com/unix_time.htm), gives the date & time value of "Mon, 04 Mar 1974 14:48:00 GMT" when (131640480000 / 1000) as an input value of seconds.
[
{
"Date": "2011-09-19T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-09-25T12:00:00:00",
"Range": "Sep19-Sep25"
},
{
"Date": "2011-09-20T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-09-26T12:00:00:00",
"Range": "Sep20-Sep26"
},
{
"Date": "2011-09-21T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-09-27T12:00:00:00",
"Range": "Sep21-Sep27"
},
{
"Date": "2011-09-22T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Thu",
"EndDate": "2011-09-28T12:00:00:00",
"Range": "Sep22-Sep28"
},
{
"Date": "2011-09-23T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Fri",
"EndDate": "2011-09-29T12:00:00:00",
"Range": "Sep23-Sep29"
},
{
"Date": "2011-09-24T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sat",
"EndDate": "2011-09-30T12:00:00:00",
"Range": "Sep24-Sep30"
},
{
"Date": "2011-09-25T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sun",
"EndDate": "2011-10-01T12:00:00:00",
"Range": "Sep25-Oct01"
},
{
"Date": "2011-09-26T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-10-02T12:00:00:00",
"Range": "Sep26-Oct02"
},
{
"Date": "2011-09-27T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-10-03T12:00:00:00",
"Range": "Sep27-Oct03"
},
{
"Date": "2011-09-28T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-10-04T12:00:00:00",
"Range": "Sep28-Oct04"
}
]
$fmt = "MM/dd/yyyy hh:mm:ss tt"
$d = '2015-07-03 10:58:00'
([DateTime] $d).Date.ToUniversalTime().ToString($fmt)
Jim;Code: [Select]
[
{
"Date": "2011-09-19T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-09-25T12:00:00:00",
"Range": "Sep19-Sep25"
},
{
"Date": "2011-09-20T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-09-26T12:00:00:00",
"Range": "Sep20-Sep26"
},
{
"Date": "2011-09-21T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-09-27T12:00:00:00",
"Range": "Sep21-Sep27"
},
{
"Date": "2011-09-22T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Thu",
"EndDate": "2011-09-28T12:00:00:00",
"Range": "Sep22-Sep28"
},
{
"Date": "2011-09-23T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Fri",
"EndDate": "2011-09-29T12:00:00:00",
"Range": "Sep23-Sep29"
},
{
"Date": "2011-09-24T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sat",
"EndDate": "2011-09-30T12:00:00:00",
"Range": "Sep24-Sep30"
},
{
"Date": "2011-09-25T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sun",
"EndDate": "2011-10-01T12:00:00:00",
"Range": "Sep25-Oct01"
},
{
"Date": "2011-09-26T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-10-02T12:00:00:00",
"Range": "Sep26-Oct02"
},
{
"Date": "2011-09-27T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-10-03T12:00:00:00",
"Range": "Sep27-Oct03"
},
{
"Date": "2011-09-28T12:00:00:00",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-10-04T12:00:00:00",
"Range": "Sep28-Oct04"
}
]
Not sure which Win32/Drive API functions you were using so this may be completely off base but I have had good luck using the Win32/Drive SDK functions that work in 100 nanosecond increments. The timing is so fine that it varies from machine to machine so you have to get a frequency to seed the other function calls with. Generally, I use them for timing but as Chuck mentioned, the SYSTEMTIME and FILETIME structures store info in 100ns increments. WinBatch make use of both structures and associated functions internally.
and for all.... doesn't seem to matter but PS always comes up with 4am [at least on my laptop]Code: [Select]
$fmt = "MM/dd/yyyy hh:mm:ss tt"
$d = '2015-07-03 10:58:00'
([DateTime] $d).Date.ToUniversalTime().ToString($fmt)
At times, it's most annoying having to deal with all of the various methods of representing time that have been thought up over all the years that computers have existed... it's almost as annoying as having a car with "knockoffs" that are threaded left-handed & right-handed depending on which side of the car the wheels are on... ditto for lug nuts/bolts.
I did what I could. As I mentioned, if you find any other commonly used formats let me know and I will add them along with needed tweaks.
Jim
[
{
"Date": "2011-09-19T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-09-25T12:00:00.00Z",
"Range": "Sep19-Sep25"
},
{
"Date": "2011-09-20T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-09-26T12:00:00.00Z",
"Range": "Sep20-Sep26"
},
{
"Date": "2011-09-21T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-09-27T12:00:00.00Z",
"Range": "Sep21-Sep27"
},
{
"Date": "2011-09-22T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Thu",
"EndDate": "2011-09-28T12:00:00.00Z",
"Range": "Sep22-Sep28"
},
{
"Date": "2011-09-23T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Fri",
"EndDate": "2011-09-29T12:00:00.00Z",
"Range": "Sep23-Sep29"
},
{
"Date": "2011-09-24T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sat",
"EndDate": "2011-09-30T12:00:00.00Z",
"Range": "Sep24-Sep30"
},
{
"Date": "2011-09-25T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Sun",
"EndDate": "2011-10-01T12:00:00.00Z",
"Range": "Sep25-Oct01"
},
{
"Date": "2011-09-26T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Mon",
"EndDate": "2011-10-02T12:00:00.00Z",
"Range": "Sep26-Oct02"
},
{
"Date": "2011-09-27T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Tue",
"EndDate": "2011-10-03T12:00:00.00Z",
"Range": "Sep27-Oct03"
},
{
"Date": "2011-09-28T12:00:00.00Z",
"cMonth": "2011/10",
"Qtr": "4Q2011",
"DOW": "Wed",
"EndDate": "2011-10-04T12:00:00.00Z",
"Range": "Sep28-Oct04"
}
]
Assuming you have the latest, those return a Type of "UTC", don't they? Also, you should be able to return a YmdHms format if desired.
Jim
Stan's Newtonsoft script is preprocessing the data values through a database assembly, so an examination of the intermediate data that the Newtonssoft assembly is converting to JSON text seems warranted. Also, it is not clear what the rationale is for making Newtonsoft the arbitrator of some JSON conversion standard. That is not to say there isn't a rationale but just that there should be some justification.
Au contraire. Tony already chipped in about standards. I throw stuff like the Newtonsoft script because I now know it works. I have also thrown out examples of different date interpretation.I expect a STFU from someone on these threads pretty soon ::)
- Newtonsoft works with WB [it didn't for me in 2013, but that was my problem]
- Json pretty much ends up everywhere no; for me personally- in an API [work-related, cannot share]
- I could use CLR strings to create my own Json from anything
- Json 'object' typing - like the way the dates came in as milli-seconds - is it's own topic.