954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP Dates

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.

derekcpt
Light Poster
29 posts since Aug 2008
Reputation Points: 10
Solved Threads: 2
 
<?
$mysql_date = "2008-08-17";
list($y, $m, $d) = explode("-", $mysql_date);
echo date("m/d", mktime(0, 0, 0, $m, $d, $y));
?>
R0bb0b
Posting Shark
998 posts since Jun 2008
Reputation Points: 358
Solved Threads: 89
 

tttthhhaaannnkkk yyyooouuu!!!!!!!

So much!

derekcpt
Light Poster
29 posts since Aug 2008
Reputation Points: 10
Solved Threads: 2
 

no problem.

R0bb0b
Posting Shark
998 posts since Jun 2008
Reputation Points: 358
Solved Threads: 89
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You