Hi all..
I'm working with a form where I'm getting a time from a user. Right now it's a drop down form, with values between 9:00am and 9:00pm, in 15 min increments.
As I'm moving to the part where I'm inserting this bit of data into MySQL.. I'm finding that it's not the best data format.. Can anyone make a suggestion as to an elegant solution for getting a time from a user, in a format that's easily workable with the databse..
Thanks to all the suggestions so far.. The input has made learning php much easier.
Thanks
David
Getting Time From A User
Moderator: General Moderators
have a dropdown for hours, one for minutes, one for seconds (if you need it) and one for am/pm... then generate a timestamp for inserting into the DB.
http://us2.php.net/strtotime
the function called date() reverses the timestamp back into a human readable form
(if you don't keep track of times in your head as timestamps as I do of course)
http://us2.php.net/strtotime
the function called date() reverses the timestamp back into a human readable form
(if you don't keep track of times in your head as timestamps as I do of course)
That's correct.. Thanks for all the tips.. I was able to succesfully build a form that took the time the user specified, the day they specified.. Do magic things with it, and insert it into the db... Thanks a ton...jshpro2 wrote:Well I think he's prompting users for a certain time, not calculating their timezone based off what the user says their current time is