Date Format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

Date Format

Post by esandra »

//I need to take the month from the `today`(date) field and format this into `F`(January-December)
//then display this in a drop down.

//So this is how my query looks like:

"select distinct substring(date, 6, 2) as month from arrastre order by month"

//and the drop down ouputs 06, 07, 08, and 09
//the problem starts when I add this line:

$month = date('F',strtotime($mrow['month']));
//..to format the month but it would only display january 4 times instead of june, july, august, september

//How do I change this so it would format the month exactly as it should
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

Re: Date Format

Post by esandra »

never mind i got it now:

SELECT DISTINCT MONTHNAME( date ) FROM arrastre
Post Reply