musclehead Posted October 2, 2008 Share Posted October 2, 2008 Hi everyone...I'm sure this is a ridiculously-easy question, but I'm killing myself trying to figure it out. I have a date string field, let's say: $theDate = '12-25-2008'; When I echo that variable, it displays beautifully...however, when I try this: echo strtotime($theDate); I get nothing...absolutely nothing is printed on the page...I am completely and utterly stumped...someone cure my insanity/stupidity! Thanks! Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/ Share on other sites More sharing options...
DarkWater Posted October 2, 2008 Share Posted October 2, 2008 And you're sure that no number is echo'd? >_> Try adding these lines to the top of the script: ini_set('display_errors', 1); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/#findComment-655905 Share on other sites More sharing options...
musclehead Posted October 2, 2008 Author Share Posted October 2, 2008 Positive - I'm not getting any error messages, notices, nothing...it just simple doesn't appear, and I'm totally and completely stumped. Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/#findComment-655910 Share on other sites More sharing options...
discomatt Posted October 2, 2008 Share Posted October 2, 2008 http://www.gnu.org/software/tar/manual/html_node/Calendar-date-items.html#SEC116 Read up <pre><?php var_dump( strtotime('12-25-2008') ); var_dump( strtotime('12/25/2008') ); var_dump( strtotime('2008-12-25') ); ?></pre> bool(false) int(1230192000) int(1230192000) Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/#findComment-655916 Share on other sites More sharing options...
discomatt Posted October 2, 2008 Share Posted October 2, 2008 You want <pre><?php $theDate = '12-25-2008'; var_dump( strtotime( str_replace('-','/',$theDate) ) ); ?></pre> Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/#findComment-655918 Share on other sites More sharing options...
musclehead Posted October 6, 2008 Author Share Posted October 6, 2008 Thanks discomatt - that did the trick! Link to comment https://forums.phpfreaks.com/topic/126809-solved-strtotime-is-giving-me-ulcers/#findComment-658014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.