View Full Version : how to get the value of datefield

9 Nov 2009, 10:14 AM
I've got a problem with the datefield
I use datefield.getValue(), but I've got this "Mon Nov 2 00:00:00 EST 2009" and I want "2009/11/02"

Can anybody help me?

9 Nov 2009, 8:23 PM
Browse to the Date class in the docs and take a look at the format function.

9 Nov 2009, 9:49 PM
You got a date object. if you stop and read:

getValue() : DateReturns the current date value of the date field.

it does not matter the format you used. format is used for parsing the value from the triggerField(superclass).

try this...

var d=datefield.getValue();
var year = d.getFullYear();
var month= d.getMonth()+1;
var day = d.getDate();