Re: converting date into database date format(newbie)
| From: | John W. Holmes | Date: | Fri, 29 Aug 2003 13:09:31 +0000 |
| Subject: | Re: converting date into database date format(newbie) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161133@lists.php.net to get a copy of this message | ||
Anil Garg wrote:
I am reading date in the format "08-Aug-03" from a text file. While writing this date into the myqsl database's date column it shows '00-00-0000'. Is there a function or some other way to convert "08-Aug-03" type of dates in to format which is acceptable by date field of the mysql database.MySQL expects it's date in a YYYY-MM-DD or YYYYMMDD format. Try using soething like this: $mysql_date = date('Ymd',strtotime($date_from_text_file)); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com