1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    328
    Vote Rating
    1
    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
    Vote Rating
    13
    Answers
    25
    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
    328
    Vote Rating
    1
    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
    345
    Vote Rating
    17
    Answers
    15
    suzuki1100nz will become famous soon enough suzuki1100nz will become famous soon enough

      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
    7,185
    Vote Rating
    194
    Answers
    433
    scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold

      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
    15,075
    Vote Rating
    97
    Answers
    168
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      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
    328
    Vote Rating
    1
    ttbgwt is on a distinguished road

      0  

    Default


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


    returns this: 1347580800000