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
Demo
As @Mark Baker suggest if you want fix second timer than you can manually write like
echo gmdate("H:00", 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