473,800 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possible to calculate localtime based on Country/State?

Hi all,

Does anyone know of a script or package that will allow me to calculate
the localtime given a country code (and optional state/province for
US/Canada)? It should factor in daylight saving time when applicable.
If there are special cases where country + state isn't enough that's ok,
a solution that's correct 95% of the time would be better than no
solution at all.

Thanks much,
Kevin
Aug 1 '06 #1
2 2458

Kevin wrote:
Hi all,

Does anyone know of a script or package that will allow me to calculate
the localtime given a country code (and optional state/province for
US/Canada)? It should factor in daylight saving time when applicable.
If there are special cases where country + state isn't enough that's ok,
a solution that's correct 95% of the time would be better than no
solution at all.

Thanks much,
Kevin
In unix i'm fairly sure there is a directory full of different regions
with files describing the timezones.

Otherwise, you can probably find a list of states and their timezones
relatively easily. It wouldn't be hard to hand create a list, either,
its only, what? 50-60 areas?

Aug 2 '06 #2
Kevin wrote:
Hi all,

Does anyone know of a script or package that will allow me to calculate
the localtime given a country code (and optional state/province for
US/Canada)?
<snip>

May be <http://www.twinsun.com/tz/tz-link.htm>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Aug 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1889
by: Phil Powell | last post by:
print_r("From index.php 20: $prefix: stateXML = $stateXML<P>"); foreach (array('state', 'country') as $prefix) { print_r("From index.php 21: stateXML = $stateXML<P>"); ${$prefix . 'XML'} = $this->getXML($prefix . '.xml'); } I have never seen anything like this in my 3+ years of PHP coding! When I ran this code, I get the following output:
11
6479
by: Laery | last post by:
Hi, I'm currently adding a new module to an old borland C3.1 application (dos). And I need to calculate a date by subtracting the number of days from a given date. I know I could use an array of days in the months and go back by leaping when 1 is reached. (keeping the 29the of feb and january/year in mind).
5
2642
by: Raj | last post by:
Hi I'm very new to C and am trying to get the time a month ago in the format mmyy. What I have tried so far is: char *last_mth; size_t maxsize = 4; struct tm *timeptr = localtime(time(0));
1
2379
by: Emmanuel | last post by:
Hi, I have a webform with some input controls in it. Some of these controls have validation controls assigned. So far so good. I would like to have a validator which validates a field only if the value of another field is a particular value. Lets say i have a country field and a state field, i want to validate that the state field contains a value when the country field is 'US', for example.
4
13784
by: dmisen | last post by:
I have data on air pollution coming from sources across the country, and control options for reducing pollution from each source. The example below shows data for: - 2 sources (plant_ID "001" and "008") - total tons of pollution emitted from each source (20 and 25 tons, respectively) - an ID code for the each control device that could be applied to reduce the emissions - the control efficiency for each control device (percent that it...
7
4262
by: Yuanfei | last post by:
Hi There, I just found that there is a problem in vc2005 regarding to time_t and localtime. See code snippets belows. Using this code segment, I found that when ut is 86200, the corresponding output is 1970.1.1 7:56:40, when ut is 0, the output is 1970.1.1 8:00:00, when ut is 86400, the output is 1970.1.2 8:00:00. While output will be 1970 1.2 7:56:40 in VC8. Please note that I am aware that time_t is 64bit in VC2005 and using...
23
3234
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
7
9246
by: tokcy | last post by:
Hi everyone, I need the world database of country state and city. Actually i have three drop down option in my project in 1st drop down country name should come from database and 2nd drop down state name should come from database according to country and in 3rd drop down cities name should come from database according to states. I have tried many search engine but i could not get any proper info regarding this i mean some time i get whole...
5
3942
by: bennever | last post by:
Hi, I plan to use drop down lists to populate team results and will use the standard country/state drop down lists as the base code. The question: how can I populate multiple (5) states from entering one country? Here is the current code which works for one state...however if I add another "State" (class=td100) row identical to the one below neither state field offers the drop down list. <form name="form1" action=""> <table...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.