jeff5656 Posted November 19, 2009 Share Posted November 19, 2009 I have a date of birth field: If I enter a dte before 12/31/69, for instance 12/1/55: When I do this $_POST['dob'] I get 12/1/55, but when I do this: $dob = date("Y-m-d", strtotime($_POST['dob'])); echo "dob is ".$dob; I get 12/31/69. Can mysql not store dates before 1969? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 19, 2009 Share Posted November 19, 2009 MySQL can (use DATE) Problem is with strtotime which converts string to unix timestamp http://en.wikipedia.org/wiki/Unix_time You have to use something different to convert your dates, if you want to work on pre 1970 dates Quote Link to comment Share on other sites More sharing options...
jeff5656 Posted November 19, 2009 Author Share Posted November 19, 2009 When you say something different, what are you referring to? how do I do convert $_POST[dob] to pre-1970 values? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 19, 2009 Share Posted November 19, 2009 For example use explode to convert your date to an array, then create a string from resultant array that will have YYYY-MM-DD format. 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.