Hi guys my application parses text files where date values are stored in the format: DDMMMYYYY eg: 12MAR2009.
I noticed that inserting this value as it is into a database datetime value doesn’t work at all. How do I convert this into a datetime value which can be entered into a database. My application is in php.
The PHP function
strtotime()will take almost any string containing a date/time value, and convert it to a unix timestamp.The MySQL function
FROM_UNIXTIME()will take a unix timestamp and convert it to MySQL’s datetime format.