Having trouble with dates
Posted on 2000-02-17
I have a form with a date input box.
<input type="text" name="myDate">
My CF code to manipulate this is:
<cfset userDate = trim(form.myDate)>
<cfset dbDate = dateFormat(userDate, "dd/mm/yy")>
Now, the problem is: if I enter the date for 4 February 2000 as 04/02/2000, #dbDate# comes out as 02/04/00. ..and if I enter 02/04/2000, it comes out as 04/02/00. There is no problem if the dd value is greater than 12.
Since I suspected it to be a locale problem, of which my default is English (US), SetLocale("English (UK)") didn't solve the problem, neither did any other supported locale managed to change this.
How can I solve this problem?