Results 1 to 4 of 4

Thread: Problem with Date

  1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    27
    Vote Rating
    0
      0  

    Default 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
    6,154
    Answers
    501
    Vote Rating
    247
      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
    574
    Answers
    59
    Vote Rating
    74
      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
    6,154
    Answers
    501
    Vote Rating
    247
      0  

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •