In one of the webservices my application is consuming, I encountered the following DateTime format.
"/Date(1395780377459)/"
Is this some standard date format? If so, how to parse this into DateTime object?
EDIT:
Thanks for the comments. So "/Date(1395780377459)/"
corresponds to GMT: Tue, 25 Mar 2014 20:46:17 GMT
. I was wondering how to parse this in .net. Tried:
string test = "/Date(1395780377459)/";
var datestring = test.Substring(6).TrimEnd(')','/');
var date = new DateTime(long.Parse(datestring));
Tried this too:
string test = "/Date(1395780377459)/";
var datestring = test.Substring(6).TrimEnd(')','/');
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var result = epoch.AddSeconds(long.Parse(datestring));
It doesn't work. Any idea what is going wrong?