Jump to content
Larry Ullman's Book Forums

Inserting Time Into Database, A Better Way.


Recommended Posts

I noticed that the NOW() function in chapter 12 only returns time in YYYYMMDD format. Maybe this is the format the database needs, but it creates a problem if I add multiple blog posts a day. The newest ones aren't at the top because NOW() doesn't include minutes and seconds.

 

Is there a better way to send time information to the database? Thank you.

Link to comment
Share on other sites

Hello, and welcome to the forums.

 

I'm not sure if your software is configured differently from normal, but every system I have ever used has added hours, minutes and seconds to the time whenever you use NOW().

 

Is the issue, by chance, the fact that when you format the date and time retrieved from the DB, you're only grabbing the year, month and date?

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
 Share

×
×
  • Create New...