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.
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?
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?
Aucun commentaire:
Enregistrer un commentaire