我得到我的數據庫的日期,我需要顯示它作爲一個字符串。 所以Flex中我這樣做:日期到字符串<->字符串到日期
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();
}
,但我得到例如結果:
2010年7月13日0:0:15
我怎樣才能填補日,月,小時,分鐘,帶填充0的秒?
而且,我回去從字符串到日期的搭配:
DateField.stringToDate(myTextInput.text, "DD.MM.YYYY HH:MM:SS");
這是正確的嗎?我想要一個Date,我將通過BlazeDS傳輸到J2EE後端,但是我只能在數據庫中看到空值。所以出事了......
最好的問候。
方法stringToDate不起作用,因爲它是受保護的方法。我正在使用Flex 4. – Tim 2010-07-12 17:03:24
爲什麼在Flash CS4中會報錯,提示找不到定義mx.formatters.DateFormatter – 2012-03-28 08:51:38
'parseDateString()'不接受也不考慮格式化字符串,因此如果字符串被正確轉換。 – splash 2013-09-09 09:17:24