Jump to content

Problem changing the format of a date


denhamd2

Recommended Posts

Hi,

 

I have a date string being output from a database into a variable $date which looks like:

$date = "2010-09-30 12:45:52";

 

I'm trying to change the format to:

30 September 2010

(I want to get rid of the time also)

 

Does anyone know how I could do this in PHP? Any help would be much appreciated!

Link to comment
https://forums.phpfreaks.com/topic/217104-problem-changing-the-format-of-a-date/
Share on other sites

You can do this directly in your query - http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

 

It is about 8-10x faster to do this in your query when you retrieve the data than if you use some php code to do this.

 

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.