I am using codeigniter and got problem doing properly the query.
$query = $this->db->query('SELECT datetime ...');
$resultdata['results'] = $query->result_array();
foreach($results as $result)
{
echo "<tr>";
echo "<td>".$result['datetime']."</td>";
echo "</tr>";
}
This code make result of the date in this format: 2015-04-11 02:45:19. How can I do the result only with HOURS and MINUTES? Thank you.
Just use MySQL's DATE_FORMAT()
function:
$query = $this->db->query('SELECT DATE_FORMAT(datetime, "%H:%i") as `time` ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With