astralaaron Posted January 25, 2015 Share Posted January 25, 2015 I am having a hard time figuring out how to conver a date such as 01/25/2015 04 : 11 : AM to a time stamp. I've tried and failed with strtotime() does anyone know why it wouldn't work? or how I should go about doing it? Thanks Link to comment Share on other sites More sharing options...
funbinod Posted January 25, 2015 Share Posted January 25, 2015 don't use AM or PM. just use date and hours. and no space between hours and minutes... strtotime('01/25/2015 04:11'); for details, read manual---- http://php.net/manual/en/function.strtotime.php Link to comment Share on other sites More sharing options...
astralaaron Posted January 25, 2015 Author Share Posted January 25, 2015 (edited) Do you have any idea why the following will not work? It always results in 16:00 ($_POST is coming from my form which outputs an AM / PM time) // $_POST['time'] = "02:32PM";$hour24time = date("H:i", strtotime($_POST['time'])); While this works fine? Results in 14:32 $hour24time = date("H:i", strtotime("02:32PM")); Edited January 25, 2015 by astralaaron Link to comment Share on other sites More sharing options...
Jonathanks Posted January 25, 2015 Share Posted January 25, 2015 (edited) Store the time received from $_POST['time'] in another variable and use the variable name. Maybe that will work. Edited January 25, 2015 by Jonathanks Link to comment Share on other sites More sharing options...
astralaaron Posted January 25, 2015 Author Share Posted January 25, 2015 Store the time received from $_POST['time'] in another variable and use the variable name. Maybe that will work. I had already tried this Link to comment Share on other sites More sharing options...
astralaaron Posted January 25, 2015 Author Share Posted January 25, 2015 oddly just started working...don't know why Link to comment Share on other sites More sharing options...
niche Posted January 25, 2015 Share Posted January 25, 2015 Might be a problem with your cache Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now