Jump to content


Photo

Problems by inserting time AM and PM


  • Please log in to reply
1 reply to this topic

#1 coolex

coolex
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 25 September 2006 - 07:06 AM

Hello!

I try to insert times into my database.
I created a time field in a table and want to enter AM/PM time into it.
For example
"insert into test(time) values('10:00:00 PM');"
After that I want to view my table:
"select time_format(time, '%r') from test;"
I get this time (10:00:00) not as PM but always as AM. But I want it as PM in my DB.
How can I insert AM/PM time directly?

PLease help!
Thanks

Alex

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 25 September 2006 - 01:32 PM

If you want to use a formatted string for _input_, you'll need to use STR_TO_DATE().
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users