Jump to content

PHP Time


verdrm

Recommended Posts

What is the best way with PHP and MySQL to handle time?

 

In example, I have a form where the user can type in a time (12:00, 1:15) and select AM/PM from a pull down menu. The problem is I need it to display in order (12 AM is before 12 PM).

 

How can I solve that with PHP / MySQL? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/180702-php-time/
Share on other sites

I don't actually have the code yet.

 

Concept only: I have a form that has two fields:

 

- Time (ex: user input would be 9:15)

- AM / PM selection

 

The problem I anticipate is how PHP will display the results correctly since it cannot differentiate AM / PM if I just store the result in MySQL as, for example, "9:15 AM"

 

So my question is, how do I take user inputted times and AM / PM and store / retrieve properly?

Link to comment
https://forums.phpfreaks.com/topic/180702-php-time/#findComment-953485
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.