What would be the reason for anyone to store a timestamp like: 2009-04-23 00:53:30 instead of a unix timestamp? It makes it unsearchable via SQL, or at least a lot harder. So why would they do this?
No you don't. You can use php's strtotime() to convert to a timestamp. You can also do that in the sql query by using UNIX_TIMESTAMP(my_datetime_column). You can also do the formatting in sql with DATE_FORMAT()
This format generally makes it easier to search and manipulate in sql. You just need to familiarize yourself with the many date functions mysql provides.
Using ISO 8601 as the time format has several distinct advantages. First ISO 8601 is not limited to a specific range like a Unix timestamp. min: 1970-01-01T00:00:00Z the max: 2038-01-19T03:14:07Z. ISO 8601 is also very human and computer readable.
Logic without the fatal effects.
All code snippets are licensed under WTFPL.
Bookmarks