More SQL history issues
Following my previous post about recording history in a database I have come across a wonderful lifesaving query!
I have always been a unix timestamp sort of person, really easy to compare, offset and format in PHP however the database I have taken over from uses the SQL timestamp thing – I’m not even sure what it is. Which is an American formatted horror when you want to do anything with it. Like so:
2011-04-14 22:44:22
I even created my own little PHP function just to format it how I wanted using this silly query (for every date!):
But as I started to want to use offsets for different timezones it could get really messy!
However, with the use of the unix_timestamp SQL function all my issues have been solved!
Usage:
Useful links:
http://www.epochconverter.com/