now php is a great language and it has loads of really useful functions, particularly date functions - why isnt there any php functions to convert a mysql date/date-time into a unix timestamp so it can be formatted like a normal date?
The code behind the process isnt difficult... so why isnt it there?
In 5 versions of php I cant believe no-one has thought of it - so there must be a reason for it.
06-16-2006, 07:37 PM
mysql also has many useful functions, http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#id2716133
SELECT FROM_UNIXTIME(your_date) FROM table
you may also want to read about mysql's date_format function.
06-16-2006, 08:47 PM
that assumes the date is coming from an sql database ;)
06-16-2006, 09:18 PM
well, obviously but you asked about mysql not any other database system.
06-16-2006, 09:35 PM
In the situation where you have a dump from a mysql database (that you have no access to yourself) I can see a PHP function being handy...
(speaking nicely to the people who provide the dump and getting it in the format you want would be better though...)
It does?! Bonus! I tried to read the document about the formats it accepts but it made my head spin.
The 'mysql date format' is just the IS0 8601 international date format. Our data sources use it because in travel it is particularly important to have a standard date format. I simply called it the mysql date format because more people would know what that was than would understand ISO8601.