Forums

PHP

This topic is locked

Formatting Dates

Posted 11 Jun 2008 13:28:53
1
has voted
11 Jun 2008 13:28:53 Sharon Grigg posted:
Hi,

Can anyone help. I am trying to format how the date displays from a recordset.

I have the following code in my page from a recordset. <?php echo $row_News['date']; ?>

It displays the date in this format: 2008-06-11

I would like to have it appear like this. 11th June, 2008. Can anyone help please?

Thanks

Sharon

SHARON

Replies

Replied 12 Jun 2008 10:48:46
12 Jun 2008 10:48:46 Alan C replied:
Hi Sharon,

the date function will do whatever you want, try this . . .


<pre id=code><font face=courier size=2 id=code> echo date('d F, Y');</font id=code></pre id=code>

making sure you keep the spaces exactly where they are as they are part of the formatting string, full documentation is here . . .

uk2.php.net/date



Reply to this topic