Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
44
rated 0 times [  46] [ 2]  / answers: 1 / hits: 59500  / 11 Years ago, thu, january 23, 2014, 12:00:00

I pick some date and time in javascript and then want to store it on server (.NET). Dates are supposed to be in future from the current moment (so they won't be before 1970).
Having read topics here on SO I learnt it's better to store date as a string and people suggest using Date.prototype.toISOString() or Date.prototype.toUTCString().
I've read that toISOString() is not available in IE 7. And I'd like to know other differences, when I should choose one or another function.


More From » date

 Answers
83

They're for different purposes.



  • UTC is the primary time standard by which the world regulates clocks and time.

  • ISO is standard format time. ISO also supports ms in its format.


So if you want to send data to the server, send the ISO, because ISO is the standard format:


var date = new Date();
sendDate(date.toISOString());

You can also use toISOString in IE7 polyfill.


[#72993] Wednesday, January 22, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
samsons

Total Points: 331
Total Questions: 97
Total Answers: 106

Location: Macau
Member since Mon, Nov 16, 2020
4 Years ago
;