Hi Phil,
PHP has a wealth of both string and date function which could be used in conjunction to create the date in the format you require.
Firstly, you need to extract each relevant part from the number string and assign it to elements of an array. This can be done using the substr() function, like so:
// Define String to be Parsed
$datestring = 200109071633
// Year
$date[0] = substr($datestring,0,4);
// Month
$date[1] = substr($datestring,4,2);
// Date
$date[2] = substr($datestring,6,2);
// Hour
$date[3] = substr($datestring,8,2);
// Minute
$date[4] = substr($datestring,10,2);
This gives you the array $date, which has five elements corresponding to Year, Month, Date, Hour and Minute. You change the numbers to strings, such as 'Year' if this makes it easier to remember - I've used numbers to conserve space.
The second part of the script grabs the various parts of the array and enters it into another function, mktime(), which will return the Unix timestamp for the time given, which can then in turn be turned into any time expression you want, using the date() or gmdate() functions. The mktime() function would be written like so:
$unixtimestamp = mktime($date[3],$date[4],0,$date[1],$date[2],$date[0]);
Following this, we then use the $unixtimestamp variable with the date() function to format the date, like so:
$formatteddate = date("Y, m/d, g:ia",$unixtimestamp);
This will give you the date in the order you require.
As stated previously, these functions can be joined together to conserve space:
$formatteddate = date("Y, m/d, g:ia",mktime($date[3],$date[4],0,$date[1],$date[2],$date[0]));
But that is up to you.
Regards,
David
REFERENCES:
http://uk.php.net/manual/en/function.substr.php
http://uk.php.net/manual/en/function.mktime.php
http://uk.php.net/manual/en/function.date.php