Wyatt
2006-12-21, 14:05
I have a problem with date() in a CMS I'm developing. When I output the date an article was created exactly as stored in my database, the date displays correctly. However, when I try to format it with date(), it doesn't work. It defaults back to December 31, 1969. Here's my code. If anybody can figure this out, I'd be thrilled.
This outputs December 31, 1969:
<?php echo date("F j, Y", $Posted);?>
This outputs the correct date without formatting:
<?php echo $Posted;?>
The output:
2006-12-18 15:46:54
I just checked my log, and I found this line:
A non well formed numeric value encountered in article.php on line 2
That's the line the date is output from. Am I formatting my dates wrong when they go in the database? Is that it?
This outputs December 31, 1969:
<?php echo date("F j, Y", $Posted);?>
This outputs the correct date without formatting:
<?php echo $Posted;?>
The output:
2006-12-18 15:46:54
I just checked my log, and I found this line:
A non well formed numeric value encountered in article.php on line 2
That's the line the date is output from. Am I formatting my dates wrong when they go in the database? Is that it?