Jump to content

little confused with timestamps


astralaaron

Recommended Posts

I have been storing time with php's time() unix timestamp knowing it can be converted to the format that I want to display on my pages. Also it was easy enough for me to calculate when a posting has been online for over a month or so letting me drop them out of my database when I wanted... But everytime I learn something new from a different website or tutorial they do it differently. For example using the CURRENT_TIMESTAMP shows something like 2012-02-25 05:25:00 I feel weird not knowing if what I am doing is a good or bad method. Plus right now I am trying to think how I would use the normal timestamp that I have been using to pull out archived news by month. for example the links would like this: Archived NewsJanuary 2012December 2011November 2011October 2011etc...

Link to comment
Share on other sites

http://dev.mysql.com...rrent-timestamp check this . this work something like NOW() means the data type would be date Using timestamp has some advanatges like as it is ineteger it is faster than date type. You dont need to think about timezone and formats. you can easily swap beetween format and timezone using php functions like http://php.net/datehttp://in2.php.net/manual/en/function.date-default-timezone-set.php
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...