easyedy Posted April 1, 2008 Share Posted April 1, 2008 Hi all I'm trying to format some calendar dates for my site and since some of the calendar listings are way down the road in the future the time is "Call For Time" and when I try to format it I'm getting the 1969 error. Any thoughts on how I can change the code to work: $datelisting = strftime("<b>%b. %d, %Y</b><br>%A %l:%M %P", strtotime($datelisting])); echo $datelisting; $datelisting before formatting is: 09/12/2008 Call For Time Here is what my code spits at me: Dec. 31, 1969 Wednesday 4:00 pm What I want is: Sept. 12, 2008 Call For Time Any ideas? Thx. -E Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/ Share on other sites More sharing options...
soycharliente Posted April 1, 2008 Share Posted April 1, 2008 You've got some funky stuff going on. Like that random bracket at the end. Try ... <?php echo date('<b>M d, Y</b><b\\r />l g:i A', strtotime($datelisting)); ?> And if that doesn't work, echo what $datelisting is and show us exactly what's being passed in. Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/#findComment-506859 Share on other sites More sharing options...
easyedy Posted April 1, 2008 Author Share Posted April 1, 2008 You've got some funky stuff going on. Like that random bracket at the end. Yeah it was an array var I made it general for here and forgot to take out the bracket... Unfortunately, you code gave me the same things. $datelisting gives me this: 09/12/2008 Call For Time Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/#findComment-506865 Share on other sites More sharing options...
soycharliente Posted April 1, 2008 Share Posted April 1, 2008 Where are you getting the data? From a database? What's the datatype? Do an echo and show me what $datelisting is. Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/#findComment-506894 Share on other sites More sharing options...
easyedy Posted April 1, 2008 Author Share Posted April 1, 2008 Yes, a database. echo $datelisting returns the date & timeas a string. ie: 09/12/2008 7:00pm If there is notime it returns, ie: 09/12/2008 Call For Time Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/#findComment-506895 Share on other sites More sharing options...
soycharliente Posted April 1, 2008 Share Posted April 1, 2008 What's the datatype that you are using to store it? Maybe changing to DATETIME will solve that problem since it sounds like you're just storing it as a string. Link to comment https://forums.phpfreaks.com/topic/99048-strtotime-giving-me-the-ole-1969-error/#findComment-506897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.