1. #1
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default format date/time to UTC

    format date/time to UTC


    is there a way to define the format of a date (datefield/timefield) so that the UTC date/time is displayed?
    I´ve calculated the diff of two dates and return it as date object. In my display field I´m using the format "H:i". When displayed my timezone offset is added.

    ex:
    I´ve calculated a diff of 10:00 hours but the field displays "11:00" cause I´m living in GMT+0100.

    I can of course substract the timezone offset from the diff date but maybe there´s a date format option that I´ve overseen? Otherwise this may be a suggestion for an enhancement.

  2. #2
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    905
    Vote Rating
    40
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Not sure exactly what control you are using, but many (e.g. grid) enable you to specify a 'renderer' function.

    In that can then use Date.toUTCString() or Ext.util.Date.format() or whatever.

  3. #3
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default


    as I already mentioned I know (and use) a workaround but it would be nice to have such a format pattern option.

    In that can then use Date.toUTCString() or Ext.util.Date.format() or whatever.
    Date. toUTCString() does not return a nice userfriendly string and with Ext.util.Date.format() you run into the same problem as I did. Probably not you because you are living in GMT tz but the 99% of people at the world who live somewhere else.

Similar Threads

  1. Date Time format
    By erenault in forum Ext.nd for Notes/Domino
    Replies: 0
    Last Post: 16 Nov 2010, 5:42 AM
  2. Date Format + Date Column on Grid
    By smichels in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 22 Jul 2010, 8:25 PM
  3. Replies: 2
    Last Post: 23 Mar 2009, 12:44 AM
  4. How to change date format after a date field has been created?
    By lensesby in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 3 Mar 2009, 7:11 AM
  5. date format on grid. Format is not displayed as expected.
    By mcrusty in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 26 Jan 2007, 4:05 PM

Thread Participants: 1