To convert from user format to mysql I use: $training_date=$_POST["training_date"]; $training_date=str_replace("-", "/", $training_date);//strtotime doesnt seem to work right if it has 12-25-2002, but does if it has 12/25/2002 $training_date=strtotime($training_date); $training_date=date("Y-m-d",$training_date);
To convert from mysql to user I do: $field_hire_date=$row_current_emps['field_hire_date']; $field_hire_date=strtotime($field_hire_date); $field_hire_date=date("m/d/Y" , $field_hire_date); -----Original Message----- From: Rw [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 11:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Date formatting Had trouble getting this posed at the newsgroup - will try on the maillist here: I have a date field passed in a form like this: "01-02-2003" Is there a handy function to convert that to other ways of expressing the date such as: "01/02/03" OR "2003-01-02" I know the syntax of the date formatting expressions ... just not for the converting. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php