1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    372
    Vote Rating
    5
    ttbgwt is on a distinguished road

      0  

    Default Unanswered: Ext.util.Format.date question

    Unanswered: Ext.util.Format.date question


    Why does this:
    Code:
    Ext.util.Format.date('2012-09-14', 'Y/m/d');
    return this? 2012/09/13 and not 2012/09/14

  2. #2
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Answers
    26
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    Not for me, on 4.1.1 - check out this jsFiddle: http://jsfiddle.net/bJ2qs/

  3. #3
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    372
    Vote Rating
    5
    ttbgwt is on a distinguished road

      0  

    Default


    hmm... I just ran your fiddle and I still get same results

    ext-ss.png

  4. #4
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    447
    Answers
    21
    Vote Rating
    62
    suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough suzuki1100nz is a jewel in the rough

      0  

    Default


    Hi what browser and what ExtJS version - I tested it in Chrome, IE9, Firefox with ExtJS 4.1.1 and it worked fine

  5. #5
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,010
    Answers
    667
    Vote Rating
    460
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    What I use is:

    For format.date, use:
    Ext.util.Format.date('2012/09/14', 'Y/m/d');
    For the field define for date field use:
    { name : 'date_field', type : 'date', dateFormat : 'Y-m-d' },
    Scott.

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,943
    Answers
    461
    Vote Rating
    636
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Note:

    The value to format. If a string is passed, it is converted to a Date by the Javascript's built-in Date.parse method.
    What does Date.parse return on that string?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #7
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    372
    Vote Rating
    5
    ttbgwt is on a distinguished road

      0  

    Default


    Code:
    Ext.getBody().update(Date.parse('2012-09-14'));
    


    returns this: 1347580800000