I've been using the unix timestamp all my life.
I like it because it's easy to compare, it's fast because I store it as an integer. And since I'm using PHP, I can get any date/time format with date() function from the unixtimestamp.
Now, some people are saying that it's best to use the DATETIME format. But besides the more suited name, I don't see any advantages.
Is it indeed better to use DATETIME, if so, what are the advantages?
Thanks.
One advantage of using the MySQL date/time types is to be able to more simply use the date/time functions in MySQL.
The
DATE
type also has the advantage in that its only storing day, month and year so there is no space wasted or comparison complication that a seconds since epoch time would have for situations where you only cared about the day and not the time.Personally I tend to use a database as just a dump for data so such functions are of little interest. In PHP I tend to just store the date in integer format for pretty much the reasons you state.