View Full Version : DateField format problem

6 Nov 2008, 7:38 AM
Hey All,

I am working with a date field on my form....

fieldLabel: 'Requested Delivery Date',
name: 'startdt2',
format: 'm-d-Y',
id: 'startdt2',
value: 'nodate',
showToday: false,
endDateField: 'enddt2'

This renders fine and when the date chooser is used, displays the date correctly as:
11-06-2008 - However, when I retrieve the date value to test it in my "beforeaction"

I get this: "Thu Nov 6 2008 00:00:00 GMT - 0500 (Eastern Standard Time)" :-?

when what I really need is this: 11-06-2008 :>

Is there something else I need to do to get it formatted correctly?


6 Nov 2008, 12:14 PM
Did you not notice that you are actually getting an object and not a string? This is the standard javascript date object, which has many methods and properties that are usefull for manipulating dates. Ext even augments it with a few extras, documented in the API docs. The 'format()' method should be of particular interest to you.

7 Nov 2008, 10:24 AM
Great! Thanks.