dadamssg Posted January 14, 2009 Share Posted January 14, 2009 hi, Im creating a form where the user can enter in a date and time...say they want to enter Jan 3 2009 6:00 am. Keeping the php side of the form in mind and making it simple for the user to choose, i want to store their input in my database as datetime. Any suggestions on how i could do this in the form which wouldn't require a lot of manipulating variables to enter in the mysql database in the correct format for datetime to understand? ive thought about just creating a text field, but then drop down menus could make it easier but prolly more difficult to get in the right format. thanks Quote Link to comment https://forums.phpfreaks.com/topic/140759-suggestions-please/ Share on other sites More sharing options...
corbin Posted January 15, 2009 Share Posted January 15, 2009 strtotime might help you. If it were entered in a working format, you could convert it to a unix timestamp and do anything from there. I suggest figuring out someway to make sure the client enters the data as wanted though. Perhaps a JS calendar or drop downs or something. Quote Link to comment https://forums.phpfreaks.com/topic/140759-suggestions-please/#findComment-737486 Share on other sites More sharing options...
Daniel0 Posted January 15, 2009 Share Posted January 15, 2009 That's going to be difficult. Does 01-02-2009 mean January 2 or February 1, for instance? It'll be better to enforce a particular format. Quote Link to comment https://forums.phpfreaks.com/topic/140759-suggestions-please/#findComment-737544 Share on other sites More sharing options...
corbin Posted January 15, 2009 Share Posted January 15, 2009 That's going to be difficult. Does 01-02-2009 mean January 2 or February 1, for instance? It'll be better to enforce a particular format. Hrmmm true.... Wonder if PHP is locale specific when it comes to strtotime (I bet it is), because if so, it would decide differently on different servers. Hrmmm... Quote Link to comment https://forums.phpfreaks.com/topic/140759-suggestions-please/#findComment-737948 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.