Jump to content

[SOLVED] Easy Date Formatting Question


webref.eu

Recommended Posts

Hi All

 

I'm lifting a date and time field from my database and displaying it on the page with:

 

echo "Date Added: " . $row[ProductDateAdded] . "<br /><br />";

 

which gives me date and time results like: 

 

2009-06-02 11:38:35

 

However, I just want the date formatted to an American standard as follows: 

 

Jun 2 2009

 

So what's the code to do that please? 

 

Many thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/161067-solved-easy-date-formatting-question/
Share on other sites

Changing the format in the SELECT query is 8-10 times faster than using php code, in case you have a lot of data or your site has a lot of visitors. (Edit: actually the time it adds to the query, that you are executing anyway, makes it several hundred times faster than using php code.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.