I want to assign date to Date field that is in DD-MM-YYYY format. That is I receive String Closure_Date which contains date in DD-MM-YYYY format. I want to assign that date to Date field like dtCloseDate.selectedDate=new Date(Closure_Date); In this case If Closure_Date contains 16/11/2011 it takes 16 as month so it takes 12 and adds remaining 4 months and it returns 04/11/2012. My question is how to assign date(DD-MM-YYYY) to DateField? If I use Dateformatter(DD-MM-YYYY) like dtCloseDate.selectedDate=new Date(Dateformatter.format(Closure_Date)); It Returns NaN

有帮助吗?

解决方案

DateField has a handy static stringToDate function that you can use to parse a date with a given format.

dtCloseDate.selectedDate = DateField.stringToDate("16-11-2011", "DD-MM-YYYY");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top