Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
spl020408yDepends where it's stored! Use a DATE or TIME type in an SQL database. Databases are good at date arithmetic on those.
If it's just in your own program (in a variable or memory store say) use whatever makes most sense. -
oroys8178y@iranjith4 If you need Unix time, just use Unix_timestamp(Column). Need to group dates by week? Week(Column). The list goes on. And datetime is human readable.
-
spl020408y@iranjith4 You can manipulate dates easily within the database if they're stored as the correct type!
-
I prefer unix timestamp. Easier to compare and manipulate. And easy to convert to real date. No problems with different localtimes/timezones/dst and all that crap if the db is moved between systems.
Unixtime is same in the whole world. universal time. (and if system is supposed to last part 2038, then use 64 bit unix time) -
First one. So much easier to read. I can get minute, hour, day, year, etc right off the bat from the first one, but I have to locate those in the second one
-
spl020408y
Related Rants
!rant
what is better, and what do you prefer, storing time like "1471275311" or "2016-08-11 18:50:42"
undefined
php
time
mysql