Could you not have just called the date() or now() to the variable and formatted it accordingly?
Anyway I'm assuming you already have this date (and proberly a good few others) and all you want to do is convert them.
Well, here at PHPBuilder we don't like giving the answer away freely in detail. We like to either give a small snippet of example code or point you in the right direction.
Ok here goes...
It would be possible to just write code to convert JUST these numbers to what you need but you probably want to input any date of "dd-mm-yyyy" format to convert it to "dd/p month yyyy".
please note these letters areb't the proper date formats, just examples
So, you want to first divide the date up into seperate variables, run IF statements on these numbers to convert them into the desired format and code some sort of output for these dates.
Ok sod it, I'll do some of the code but it won't be completely clean. It won't return any 'or die's or anything like that.
$NewDateArray = explode("-","$col1new");
// This will take the date and divide it up. The explode function cuts where the -s are and puts the values into the array called $NewDateArray.
/*************************
Day number conversion below
*************************/
if ($NewDateArray[0] == 31)
{
$day = "31st ";
}
/* Repeat this IF statement for all 31 days. You can copy/paste/modify that code yourself. This is a small snippet :) */
/**************************
Month number conversion below
**************************/
if ($NewDateArray[1] == 12)
{
$month = "December ";
}
/* Repeat this one, too */
/****************************
Year number conversion below
****************************/
//No actual conversion as such here, we just need to take it out of the array for easy handling later when we merge all these variables into one for the complete date.
$year = $NewDateArray[2];
/****************************
Now we put all of these together
to form the complete string
****************************/
$NewDate = $day . $month . $year;
As you would expect, this code could be done differently.
How is the date saved to this variable, anyway? Does is take the current date and save that directly, or does it take a user's input?
Anyway this should help. Hope it does!