I am having trouble with converting time, when I use the date() function on a mysql timestamp, it only returns 16:00.
Am I using the date() function wrong?
PHP:
date_default_timezone_set('America/Los_Angeles');
$date = date('H:i:s A');
echo "System: $date <br />";
$dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT CURTIME() as timestamp";
$result = mysqli_query($dbc, $query) or die(mysqli_error());
$row = mysqli_fetch_assoc($result);
echo "DB CurTime: ".$row["timestamp"]."<br />";
echo "DB CurTime Converted: ".date("H:i:s A",$row["timestamp"]);
OUTPUT:
System: 20:41:23 PM
DB CurTime: 20:41:23
DB CurTime Converted: 16:00:20 PM