Jump to content

time converstion


hoachen
 Share

Recommended Posts

I just can't get this to work!!! Please somebody help!I want to get this time convert them from 7:30 pm to 19:30:00 or 7:30 am to 07:30:00 This time is manually type in because it is a time for appointment schedule so i can't use now() $startdt = $_POST['StartDate']." ".$_POST['StartTime']. " " . $_POST['sampm'];

Link to comment
Share on other sites

If it's all in one field, then you need to parse up what they enter, get the hour, get the minutes, get the am/pm, and determine if you need to add 12 to the hour or not (or set the hour to 0). You can use str_pad to add a leading zero to the output when you rebuild the string.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...