I get the date from the C # server side 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 from 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 time zone, since if it is 17.15, it gives me 19.15 GMT +2!
At first, I just tried to pass my C # timestamp without the code above and found this question: How do I format a Microsoft JSON date? But I do not know what JSON is, and I could not understand what I could do! Is it easier to use JSON? If so, can anyone help me? Many thanks
Edit: solution - I did not use universal time on the server side. I left the server side code as is. All I have done is:
new Date(timestamp).toUTCString()
test
source share