Jump to content

Archived

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

coolex

Problems by inserting time AM and PM

Recommended Posts

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

Share this post


Link to post
Share on other sites
If you want to use a formatted string for _input_, you'll need to use STR_TO_DATE().

Share this post


Link to post
Share on other sites

×

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.