timezone

In Rails, how do I convert and print a time to a different time zone?

I have a variable, start_time: (rdb:5) start_time.class ActiveSupport::TimeWithZone (rdb:5) start_time Tue, 23 Feb 2010 14:45:00 EST -05:00 (rdb:5) start_time.in_time_zone(ActiveSupport::TimeZone::ZONES_MAP["Pacific Time (US & Canada)"]).zone "PST" (rdb:5) start_time.in_time_zone(ActiveSupport::TimeZone::ZONES_MAP["Pacific Time (US &...

Javascript/PHP and timezones

Hi, I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here: http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/ So this gives me the offset along with the DST indicator. Now, I want to use ...

Parse timezone abbreviation to UTC

How can I convert a date time string of the form Feb 25 2010, 16:19:20 CET to the unix epoch? Currently my best approach is to use time.strptime() is this: def to_unixepoch(s): # ignore the time zone in strptime a = s.split() b = time.strptime(" ".join(a[:-1]) + " UTC", "%b %d %Y, %H:%M:%S %Z") # this puts the time_tupl...

Automatically determine timezone using phone number - looking for database mapping

Hi, We require phone numbers from our customers for several reasons, and we need to know what timezone they are in for calling them. I was thinking of automatically setting their timezone based on their area code. Is there a free database I could import which maps area codes to timezones? I know there are several web sites you can quer...

PHP: storing/displaying relative dates in UTC

I have a list of dates stored in MySQL using PHP. These were stored using the following code: date_default_timezone_set('UTC'); $strDate = date("Y-m-d H:i:s",time()); I can only test this from my timezone, which is also UTC! If a web visitor from eg Eastern Time USA views the page, will the date be converted to UTC correctly? Presu...

Date parsing/formating with TimeZone and SimpleDateFormat problem around DST switch

Hi everyone, I went throe multiple posts about TimeZone and SimpleDateFormat on Google and Stack Overflow, but still do not get what I'm doing wrong. I'm working on some legacy code, and there is a method parseDate, which gives wrong results. I attached sample JUnit which I'm trying to use do investigate issue. First method *(testPars...

"GMT" instead of "UTC" in Ruby 1.8

According to the Ruby docs for Time#zone: As of Ruby 1.8, returns "UTC" rather than "GMT" for UTC times. My OSX-using comrades see this behavior. On my Ubuntu 9.10 system, however, Ruby 1.8.7 seems to prefer the old "GMT" terminology: $ ruby --version ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] $ ruby -e 'puts Time.now.ut...

Timezone lookup

Hello everyone, I have a file that contains the following in a csv file; country,region,city,postalCode,metroCode,areaCode I need to find the time zone for the entries. I have seen olson database and geonames, i was lost with olson database. couldnt find anything useful. is there any web site i can access the time zone information ba...

getting current hour, minutes and seconds in iPhone

Hi! How can I get the current hour, minutes, and seconds from this? NSDate *now = [NSDate date]; Thanks! I want to have 3 int variables with the values stored in them, not a string which displays the values. ...

Timezone differences between PHP and MySQL

I've run in to an issue whereby PHP and MySQL seem to disagree on which timezone they should be using when converting certain timestamps back to date and time. The problem arises when I have a timestamp which I would like to convert back to a datetime format. PHP gives the date and time based on GMT being the timezone, but MySQL seems t...

Location based Timezone Retrieval

Given: LDAP stores location of users. How do I drive their timezones using their location? Any pointers are accepted, Java language preferred. Thanks in advance. ...

Android Convert Central Time to Local Time

I have a MySql database that stores a timestamp for each record I insert. I pull that timestamp into my Android application as a string. My database is located on a server that has a TimeZone of CST. I want to convert that CST timestamp to the Android device's local time. Can someone help with this? ...

trying to understand java SimpleTimeZone rules

hi there, Can any one explain how Java SimpleTimeZone rules are interpreted. For example a rule for Europe/London is as follows: var rule = { "dstSavings": 3600000, "startYear": 0, "startMonth": 2, "startDay": -1, "startDayOfWeek": 1, "endMonth": 9, "endDay": -1, "endDayOfWeek": 1, "endTime": 3600000,...

How to programatically convert a time from one timezone to another in C?

The info pages for the GNU date command contains this example: For example, with the GNU date command you can answer the question "What time is it in New York when a Paris clock shows 6:30am on October 31, 2004?" by using a date beginning with `TZ="Europe/Paris"' as shown in the following shell transcript: $ export TZ="...

Exception calling when TimeZoneInfo.ConvertTimeToUtc for certain DateTime values

When I run the code for this specific value of dt, an exception is thrown when I call the ConvertTimeToUtc Method. My local Machine timeZoneId is "GMT Standard Time" var tzi = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); var dt = new DateTime(1995, 4, 2, 2, 55, 0); var t = TimeZoneInfo.ConvertTimeToUtc(dt, tzi); The e...

.NET webservice datetime.now - time zone

I need to return server time from a webservice. I've got the following code: <WebMethod()> _ Public Function GetDate() As DateTime Return DateTime.Now End Function The code always returns time based on timezone of the connected client (if I change the time zone, the webservice returns updated time, instead of local server tim...

Convert a time to specified time zone using C#?

I'm working on an application in C# with .Net 3.5. I have time zone value of the User is stored in DB with this format (-05:00,1), where -5.00 represents EST time zone value and the 1 indicates that this time zone follows daylight saving (if 0 not a daylight saving zone). Now I want to convert any date time value into this timezone val...

DST change handling in a daemon process (*NIX)

In a *NIX environment, if I have a 24x7 running application, how do I handle DST changes? I am looking for a solution for my app written in C/C++. ...

convert Gmt timezone to CET in iPhone?

I want to convert GMT +530 to CET (Central European Time) in iPhone sdk? does anybody have idea about this? also tell me what is the time difference between these two? Means if time is 10 am in gmt +530 then what it will be in CET? ...

Mapping US zip code to time zone

When users register with our app, we are able to infer their zip code when we validate them against a national database. What would be the best way to determine a good potential guess of their time zone from this zip code? We are trying to minimize the amount of data we explicitly have to ask them for. They will be able to manually se...