I get a Date of my database and I need to show it as a String.
So in Flex I do this:
public static function dateToString(cDate:Date):String {
return cDate.date.toString()+"."+
cDate.month.toString()+"."+
cDate.fullYear.toString()+" "+
cDate.hours.toString()+":"+
cDate.minutes.toString()+":"+
cDate.seconds.toString();
}
But I get for example the result:
13.7.2010 0:0:15
How can I fill the day, month, hours, minutes, seconds with padded 0?
And, I go back from String to Date with:
DateField.stringToDate(myTextInput.text, "DD.MM.YYYY HH:MM:SS");
Is this correct? I want to have a Date which I will transfer via BlazeDS to a J2EE Backend, but I only see in the database then a null value. So something is going wrong...
Best Regards.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…