Jump to content

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.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.