PAkerly
2011-02-02 15:01:42 UTC
Hello,
I've got a PHP web form that users enter time into. Usually the user
enters time as:
1215
1205
215
etc...
Is there a way I can convert these times to:
12:15
12:05
2:15
etc..
or another time format when they are being entered into the DB? Here
is how I am getting them into the DB now. I want to do this so that
later I can query the DB for times.
what time format do they need to be in in mysql?
$sql="INSERT INTO mydb (time1,time2)
VALUES
('$_POST[txttime1]','$_POST[txttime2]')";
thanks.
I've got a PHP web form that users enter time into. Usually the user
enters time as:
1215
1205
215
etc...
Is there a way I can convert these times to:
12:15
12:05
2:15
etc..
or another time format when they are being entered into the DB? Here
is how I am getting them into the DB now. I want to do this so that
later I can query the DB for times.
what time format do they need to be in in mysql?
$sql="INSERT INTO mydb (time1,time2)
VALUES
('$_POST[txttime1]','$_POST[txttime2]')";
thanks.