PDA

View Full Version : Problem with Date



JAD1951
5 Sep 2013, 4:23 PM
I have a date : d = Date {Sat Jun 17 2006 00:00:00 GMT+0200}
But d.getUTCDate(); gives me 16. Why ?

Best regards

slemmon
10 Sep 2013, 3:55 PM
Try creating your date object using the Ext.Date parse method:
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Date-method-parse

That method will allow you to specify the date format explicitly.

doesn't work for me


var d = new Date ('Sat Jun 17 2006 00:00:00 GMT+0200');
console.log(d.getUTCDate());


works for me


var d = new Date ('Sat Jun 17 2006');
console.log(d.getUTCDate());


So, I wonder if it's just how it's natively parsing the date in the first place.

ettavolt
10 Sep 2013, 9:57 PM
I have a date : d = Date {Sat Jun 17 2006 00:00:00 GMT+0200}
But d.getUTCDate(); gives me 16. Why ?
Because the Earth is round and rotates about its own axis. :)
I mean - midnight on +2h timezone is 2h before the GMT/UTC midnight.

slemmon
11 Sep 2013, 9:56 AM
Oh, there you go. :)
Didn't realize that +0200 was before.