crf1121359 Posted August 18, 2013 Share Posted August 18, 2013 Hello, 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: EXAMPLE Can someone please help me out with this. i can follow a tutorial or something as well if there are any? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
PravinS Posted August 20, 2013 Share Posted August 20, 2013 check PHP time zone section http://php.net/manual/en/timezones.php also check http://wwp.greenwichmeantime.in/to/ist/to-est/ Quote Link to comment Share on other sites More sharing options...
crf1121359 Posted August 21, 2013 Author Share Posted August 21, 2013 (edited) check PHP time zone section http://php.net/manual/en/timezones.php also check http://wwp.greenwichmeantime.in/to/ist/to-est/ 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 August 21, 2013 by crf1121359 Quote Link to comment Share on other sites More sharing options...
PravinS Posted August 21, 2013 Share Posted August 21, 2013 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 Quote Link to comment Share on other sites More sharing options...
crf1121359 Posted August 21, 2013 Author Share Posted August 21, 2013 (edited) 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 August 21, 2013 by crf1121359 Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 21, 2013 Share Posted August 21, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.