Question

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

Was it helpful?

Solution

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");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top