Jump to content


Photo

PHP Date Format question


  • Please log in to reply
3 replies to this topic

#1 laide234

laide234
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 08 August 2006 - 04:52 PM

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???

#2 logged_with_bugmenot

logged_with_bugmenot
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 08 August 2006 - 05:19 PM

'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().
Earn money with Google AdSense

#3 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 08 August 2006 - 05:22 PM

echo date("F, jS Y", strtotime($job_date));[code]

Try that...[/code]


#4 laide234

laide234
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 08 August 2006 - 06:27 PM

You, sir, are a godsend!  ;D
Thanks Daniel0. It worked perfectly.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users