PDA

View Full Version : A question about date.format in Datepicker



MadEric
23 Nov 2011, 7:02 PM
I'm using Datepicker to select date.
When I click a date, the "select" event of Datepicker is triggered. In the event handler, I want to format the second parameter, its type is Date. I execute date.format('yyyy-MM-dd'), I get a wrong result : "11111111-NovNov-2424" . The expected result is 2011-11-24. I traced the process and found the date.format function has become like this :
function (a) { if (Date.formatFunctions[a] == null) { Date.createFormat(a) } return Date.formatFunctions[a].call(this) };

I really need help, thanks!

StuartAshworth
24 Nov 2011, 1:30 AM
Check out the Date formatting options in the Date docs (http://docs.sencha.com/ext-js/3-4/#!/api/Date) which are very similar to PHP if you are familiar with that.

The format you want is - "Y-m-d"