I have a time returned from database in php as 92500. But i want to format the time as 09:25 how can do this echo date ('H:i',strtotime($row['time']))
.it is outputting 00:00. How can i get 09:25
php //current Date, i.e. 2013-08-01 echo date("Y-m-d"); //current Time in 12 hour format, i.e. 08:50:55pm echo date("h:i:sa"); //current Time in 24 hour format, i.e. 18:00:23 echo date("H:i:s"); //current Month, i.e. 08 echo date("m"); //current Month name, i.e. Aug echo date("M"); ?>
The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
The editor provides the document formatting feature for PHP documents. Right-click the editor area and choose Format Document . In order to format the document, it must be syntax-error free. The code formatting normalizes whitespaces, line endings, opening and closing braces, indentation and pretty print spaces.
Actually
$date = '9:25';
echo date ('H:i',strtotime($date));
is working perfectly fine for me.
Returns "09:25".
So i guess it has to be some error with your database value meaning $row['time'] doesn't contain the right value.
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