TylerNZ -
Read your post, have been tackling the same problem, and I think I've got a good straightforward solution, so thought I'd share.
I am using the timestamp field in MySQL - what none of the documentation explains is that this is a COMPLETELY different format from Unix timestamp.
So I wrote a function, convertTimestamp(), that converts any (I think) MySQL timestamp to a Unix one, and returns the Unix timestamp. You can then call this function as an argument of your date format function.
<?php
function convertTimestamp($my_ts) {
/* This function splits up a MySQL timestamp and returns it as a unix timestamp
argument: $my_ts - data from a mysql timestamp column */
// extract integers for hour, minute, second, month, day, and year as arguments for mktime()
$my_hr = substr($my_ts,8,2);
$my_min = substr ($my_ts,10,2);
$my_sec = substr ($my_ts, 12,2);
$my_mon = substr ($my_ts,4,2);
$my_day = substr ($my_ts,6,2);
$my_yr = substr ($my_ts,0,4);
// convert to unix timestamp value
$unix_ts = mktime($my_hr,$my_min,$my_sec,$my_mon,$my_day,$my_yr);
return $unix_ts;
}
/* assign mysql data to variable */
$my_ts = $row_comments['commentDate'];
/* format unix timestamp with php date function */
echo date("F j, Y, g:i a", convertTimestamp($my_ts)); ?>