Darkness wrote:
But for this wont i need the date stored in the table in the colums, 1 for year, the next for month and the last for day?
No! The explode() functions works like this.
Say you have a variable set to a date.
$date = "2001-11-03";
The explode function breaks the data wherever there is a "-"(or whatever you specify) and creates an array.
Like this:
$exp = explode("-",$date);
Will create an array called $exp, or whatever you name it.
Therefore:
$exp[0] will equal "2001"
$exp[1] will equal "11"
and $exp[2] will equal "03"
Then you can simply rearrange the variables in the order you desire.
$new_date = "$exp[2]-$exp[1]-$exp[0]"
Which in this case will be 03-11-2001, or DD-MM-YYYY. This is really just string manipulation not date conversion, but it works quite nicely. I often use it to convert from MySQL YYYY-MM-DD to the preferred format MM/DD/YYYY. Of course you could do it with your MySQL select statment, but I can't remember the MySQL functions off the top of my head!
Rodney