Using ExtJS 4.0.2
, I can type the following into the console:
Ext.util.Format.date('2012-01-13', "m-d-Y");
I get 01-12-2012
Why?
I can correct it with:
Ext.util.Format.date('2012-01-13 00:00:00', "m-d-Y");
Ext.util.Format.date in Ext 4.0.2 uses a Date object or a String (your case). This string is parsed using the native Date.parse() using the UTC time zone.
Try to explicitly parse it using Ext.Date.parse:
var dt = Ext.Date.parse("2012-01-13", "Y-m-d");
Ext.util.Format.date(dt, "m-d-Y");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With