I am getting a date from server side C# using the following code:
DateTime d1 = new DateTime(1970, 1, 1);
DateTime d2 = (DateTime)c.ccdTimestamp2;
long x = new TimeSpan(d2.Ticks - d1.Ticks).TotalMilliseconds;
When I get my code on the javascript side:
function (timestamp) {
alert("testing :" + new Date(timestamp))
}
This gives me a fully formatted date but it does not bring the time of my timezone since if it is 17.15 here, it provides me with 19.15 GMT +2 !
At first I simply tried to pass my c# timestamp, without any of the code above and found this question: How do I format a Microsoft JSON date? But I have no idea what JSON is and I couldn't derive what I can do! Is it easier to use JSON? If so can anyone guide me? Thank you very much
Edit: The Solution - I did not use universal time on the server side. I left server side code as it is. All I did is this:
new Date(timestamp).toUTCString()