yoda699 Posted November 24, 2009 Share Posted November 24, 2009 Hey, So I got a form that requires the user to insert: the hour, the minuets, and if its AM or PM. what I get is three variables: $hour $minuets $amPm Those variables are combined into a string. I need to convert this somehow to readable format for mysql server and insert the data. I found loads of function to convert date from mysql into strings, but not the other way around. Any suggestions about this issue? Thanks, Quote Link to comment Share on other sites More sharing options...
dgoosens Posted November 24, 2009 Share Posted November 24, 2009 in MySQL make the data DATETIME in PHP $date = date("Y-m-d H:i:s"); (for instance) http://uk.php.net/manual/en/function.date.php Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 24, 2009 Share Posted November 24, 2009 http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date Quote Link to comment Share on other sites More sharing options...
yoda699 Posted November 24, 2009 Author Share Posted November 24, 2009 STR_TO_DATE is an mysql function. is there a php equivalent? Quote Link to comment Share on other sites More sharing options...
thebadbad Posted November 24, 2009 Share Posted November 24, 2009 Something like echo date('H:i:s', strtotime('03:50 PM')); ? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 24, 2009 Share Posted November 24, 2009 Since you want to put in MySQL, I thought MySQL function will work for you thebadbad's solution should work Quote Link to comment 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.