I have this piece of code for getting a mysql date and making it look pretty (real words) in php, donated by a kind soul in this forum:
Code: Select all
function convert_date_time($date)
{
$date = "$date";
$parts = explode( "-", $date );
$timestamp = mktime( 0, 0, 0, $parts[1], $parts[2], $parts[0] );
$return_date = date( "l, d M Y", $timestamp );
return ($return_date);
}I now have a mysql datetime format (0000-00-00 00:00:00) and want to do the same thing except only extract the time from the data. I've been playing around but to no luck
I'm wondering if somebody could help out? This is what I have so far, and it fails, it shows 12:00 all the time.
Code: Select all
function convert_date_time($date)
{
$date = "$date";
$parts = explode( "-", $date );
$timestamp = mktime( 0, 0, 0, $parts[1], $parts[2], $parts[0] );
$return_date = date( "g:i", $timestamp );
return ($return_date);
}Rob