1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    374
    Vote Rating
    13
    ttbgwt will become famous soon enough

      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
    14
    Answers
    26
    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
    374
    Vote Rating
    13
    ttbgwt will become famous soon enough

      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
    464
    Vote Rating
    69
    Answers
    21
    suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice

      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,197
    Vote Rating
    482
    Answers
    690
    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
    17,162
    Vote Rating
    674
    Answers
    474
    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
    374
    Vote Rating
    13
    ttbgwt will become famous soon enough

      0  

    Default


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


    returns this: 1347580800000