Jump to content

Time + n Hours causing 24 hr clock probems....


nevynev

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.