Jump to content

storing time in a database


Lodius2000

Recommended Posts

So here is a whole slew of questions

 

I creating a cms, blog style, on my entry creation page I have created a series of select menus that allow me to set a time of creation for the current entry, problem is i cant figure out how to input it into the database so that I can get it back out and parse different parts of it at different places

 

i.e.  my entry when displayed on my index.html will say 'Posted at "time(including am or pm)" on "day", "month" "date", "year".'

 

so my first question is, would I be better off using a mix of INT and VARCHAR fields in my DB table or should I use DATETIME, or TIMESTAMP, or DATE and TIME?

 

second, if I use mktime() is there a reverse mktime() to convert the seconds back to a date for retrieval, and if i use mktime() what type of MySQL field do I use, INT, or is there one I am not seeing with my handy dandy MySQL cheat sheet?

 

thanks so much for your help

 

 

Link to comment
https://forums.phpfreaks.com/topic/108086-storing-time-in-a-database/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.