The Little Guy Posted June 4, 2008 Share Posted June 4, 2008 why doesn't this echo out the time stamp? $bday = 07221986; $bday = substr_replace($bday, ' ', 2, 0); $bday = substr_replace($bday, ' ', 5, 0); echo strtotime($bday); OR $bday = 19860722; $bday = substr_replace($bday, ' ', 4, 0); $bday = substr_replace($bday, ' ', 7, 0); echo strtotime($bday); Link to comment https://forums.phpfreaks.com/topic/108731-solved-strtotime/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 4, 2008 Share Posted June 4, 2008 In the first one, the substr_replace() is not doing what you think (echo $bday to see what it contains.) In the second one, spaces between the fields are not one of the formats that strtotime() understands for yyyy-mm-dd and it returns a FALSE value. For this one, change the spaces to dashes - Link to comment https://forums.phpfreaks.com/topic/108731-solved-strtotime/#findComment-557585 Share on other sites More sharing options...
The Little Guy Posted June 4, 2008 Author Share Posted June 4, 2008 I did this, and it works $bday = 19860722; $t = strtotime($bday); echo date('Y m d',$t); Link to comment https://forums.phpfreaks.com/topic/108731-solved-strtotime/#findComment-557612 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.