Date conversion
Posted: Sat Aug 05, 2006 2:21 pm
Hey,
I'm not sure what I'm doing wrong with this, so I thought I'd post it up to see if you guys could try and give me a helping hand!
I have a date field (YYYY-MM-DD) in my database, the contents of that field in the record are put in to an editable text box, I used the following code to convert it to DD-MM-YYYY This appears to 'pull' the date out of the database and convert it to the required format fine.
The problem I have arrises when I submit the form, and I presume I have to convert the date back to the YYYY-MM-DD format for the field. Anyway when I check that the date field has been updated successfully, it just has random dates appear in the fields.
Prior to the date being updated by the MySQL query, I run the following code on the variable.
If I submit 01-01-2000, the field has 23-06-2006 entered!
Anyway, I'm hoping my post made some sense, if anyone has any ideas that would be great.
Thanks alot.
I'm not sure what I'm doing wrong with this, so I thought I'd post it up to see if you guys could try and give me a helping hand!
I have a date field (YYYY-MM-DD) in my database, the contents of that field in the record are put in to an editable text box, I used the following code to convert it to DD-MM-YYYY
Code: Select all
$cdate = date('d-m-Y',strtotime($cdate));The problem I have arrises when I submit the form, and I presume I have to convert the date back to the YYYY-MM-DD format for the field. Anyway when I check that the date field has been updated successfully, it just has random dates appear in the fields.
Prior to the date being updated by the MySQL query, I run the following code on the variable.
Code: Select all
$cdate = date('Y-m-d',strtotime($cdate));Anyway, I'm hoping my post made some sense, if anyone has any ideas that would be great.
Thanks alot.