laide234 Posted August 8, 2006 Share Posted August 8, 2006 I am pulling a date from a database entry. <?php echo $job_date; ?> displays as '2006-08-07 00:00:00'I would like to format the display. But when I use <?php echo date("F, jS Y", $job_date); ?> I get 'December, 31st 1969' .This is the format that I want, but where is it getting December from??? Link to comment https://forums.phpfreaks.com/topic/16917-php-date-format-question/ Share on other sites More sharing options...
logged_with_bugmenot Posted August 8, 2006 Share Posted August 8, 2006 'December, 31st 1969' is the default date for an invalid timestamp. A recent timestamp should look like: 1155056922. You can't provide the date() function with '2006-08-07 00:00:00'. You need to give it an actual timestamp which can be generated with mktime(). Link to comment https://forums.phpfreaks.com/topic/16917-php-date-format-question/#findComment-71247 Share on other sites More sharing options...
Daniel0 Posted August 8, 2006 Share Posted August 8, 2006 [code]echo date("F, jS Y", strtotime($job_date));[code]Try that...[/code][/code] Link to comment https://forums.phpfreaks.com/topic/16917-php-date-format-question/#findComment-71250 Share on other sites More sharing options...
laide234 Posted August 8, 2006 Author Share Posted August 8, 2006 You, sir, are a godsend! ;DThanks Daniel0. It worked perfectly. Link to comment https://forums.phpfreaks.com/topic/16917-php-date-format-question/#findComment-71287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.