Hi I am using following way to convert timestamp into hour:
echo time() / 3600 % 24;
This return like 7 if its 7 GTM but I need its output such as 07:00
Please suggest.
Thanks!
you can do this with gmdate
function
echo gmdate("H:i", time());
if you want only hours than just have only H
in gmdate
gmdate — Format a GMT/UTC date/time
As @Mark Baker suggest if you want fix second timer than you can manually write like
echo gmdate("H:00", time());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.