nevynev Posted September 27, 2007 Share Posted September 27, 2007 Hi there, I've got the clocks for various cities on a site of mine and just realised that if $london time is e.g. 19:12 then $tokyo time is 27:12 !! Obviously that's wrong but I can't quite figure out how to make it work like a correct 24hr clock... Here's the code: <?php $london = date("H:i"); $paris = sprintf("%02d", date("H")+1).":". sprintf("%02d", date("i")); $milan = sprintf("%02d", ("H")+1).":". sprintf("%02d", date("i")); $new_york = sprintf("%02d", date("H")-5).":". sprintf("%02d", date("i")); $tokyo = sprintf("%02d", date("H")+.":". sprintf("%02d", date("i")); ?> Thanks for any help! NevyNev Link to comment https://forums.phpfreaks.com/topic/70932-time-n-hours-causing-24-hr-clock-probems/ Share on other sites More sharing options...
Barand Posted September 27, 2007 Share Posted September 27, 2007 $tokyo = date ('H:i', strtotime('+8 hours')); Link to comment https://forums.phpfreaks.com/topic/70932-time-n-hours-causing-24-hr-clock-probems/#findComment-356590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.