Hi,

Could someone assist me here ;-) (Again)

I am recording dates into a mysql database in the following forma:

YYYY-MM-DD
2008-08-17

date('Y-m-d')

Now, I have to get data from my mysql database, but the data has to be filtered by the month and year. So, in other words, if I have a date in the YYYYMMDD format, how do I get php to read the month and year only, from the date?

So if I have the date 2008-08-17 in my database, how do I get php to tell me that the month is 08/August and the year is 2008?

Thanx.

Recommended Answers

All 3 Replies

<?
$mysql_date = "2008-08-17";
list($y, $m, $d) = explode("-", $mysql_date);
echo date("m/d", mktime(0, 0, 0, $m, $d, $y));
?>

tttthhhaaannnkkk yyyooouuu!!!!!!!

So much!

no problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.