1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    36
    Vote Rating
    1
    kaendsle is on a distinguished road

      0  

    Default Unanswered: Ext.Date.format() only prints locale strings?

    Unanswered: Ext.Date.format() only prints locale strings?


    I have Date objects that were set using a UTC time and I want to recover that time when formatting them using Ext.Date.format(). A very simple example demonstrates that Ext.Date.format() will print a locale string.

    Code:
    var d = new Date('1998-04-15T20:00:00.0000Z');
    
    d.toUTCString();
    // "Wed, 15 Apr 1998 20:00:00 GMT"
    
    Ext.Date.format(d, 'H:i')
    // "16:00"
    
    Ext.Date.format(Ext.Date.parse('1998-04-15T20:00:00.0000Z', 'c'), 'H:i')
    // "16:00"
    I need my time string formatted a certain way, and Ext.Date.format() is extremely helpful in that regard. However, I need it to format the date as a UTC string, not a locale string. Relative to the above example, I need a way to output the string "20:00" instead of the string "16:00".

    Is this not supported? I will just have to concatenate the outputs from d.getUTCHours() and so forth?

  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    3,381
    Answers
    146
    Vote Rating
    62
    Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough Gary Schlosberg is a jewel in the rough

      0  

    Default


    I guess so. Looks like the Date docs page describes something similar in the ISO 8601 formatted dates section:
    http://docs.sencha.com/extjs/4.2.1/#!/api/Date
    Get on the Fast Track with Sencha Training http://sencha.com/training

    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    36
    Vote Rating
    1
    kaendsle is on a distinguished road

      1  

    Default


    This is the best solution I've been able to come up with to mitigate this fact:

    Code:
    Ext.Date.format(Ext.Date.add(date, Ext.Date.MINUTE, date.getTimezoneOffset()), formatString)
    ...Where date is a Date object in UTC and formatString is the desired PHP-esque format string to output. The above expression subtracts the timezone offset, producing a Date object with the wrong time, but effectively writing the correct time as a String despite the locale time formatting.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi