Jump to content

time difference between two countries?


Recommended Posts



I need to create a simple PHP script/application which will let the users search for two countries/cities in the world and the time difference between those two places will be shown to them on the page!


a simple and good example of this is here:





Can someone please help me out with this. i can follow a tutorial or something as well if there are any?



Thanks in advance.

Link to comment
Share on other sites


Thanks but none of the above URL's help me in what i am trying to achieve! I already know the PHP timezone function and i do not know what the second link has to do with my question!

Edited by crf1121359
Link to comment
Share on other sites

second link is a reference for to check difference between specific time zone


also you need to set some default time zone in your code and according to it your need to calculate the difference

 well there are plenty of "references" online if i needed one as I have posted one of the "references" myself!! also, the calculation is done using getOffset function in PHP. there is no need for setting the default time zone on the page at all.


please only reply if you can answer the question otherwise everyone can search the net these days mate.

Edited by crf1121359
Link to comment
Share on other sites

So what, exactly, are you looking for? There's not likely to be an exact tutorial for what you need. PHP has a list of supported timezones by country and determining the different between them is a simple subtraction between the GMT offset for the two timezones.


Take a look at the manual for timezone_offset_get(). Specifically, pay attention to the example given. It has about 90% of everything you need. Just create a list of all the countries and associated timezone labels from the first link PravinS provided then use the example from the manual page I linked to.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

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

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.