1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    27
    Vote Rating
    0
    JAD1951 is on a distinguished road

      0  

    Default Unanswered: Problem with Date

    Unanswered: Problem with Date


    I have a date : d = Date {Sat Jun 17 2006 00:00:00 GMT+0200}
    But d.getUTCDate(); gives me 16. Why ?

    Best regards

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,572
    Answers
    451
    Vote Rating
    203
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Try creating your date object using the Ext.Date parse method:
    http://docs.sencha.com/extjs/4.2.1/#...e-method-parse

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

    doesn't work for me
    Code:
    var d = new Date ('Sat Jun 17 2006 00:00:00 GMT+0200');
    console.log(d.getUTCDate());
    works for me
    Code:
    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.

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    573
    Answers
    58
    Vote Rating
    72
    ettavolt is just really nice ettavolt is just really nice ettavolt is just really nice ettavolt is just really nice

      0  

    Default


    Quote Originally Posted by JAD1951 View Post
    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.

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,572
    Answers
    451
    Vote Rating
    203
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Oh, there you go.
    Didn't realize that +0200 was before.

Thread Participants: 2