timezone

TimeZoneInfo and country codes

I'm looking to implement a function with a signature something like the following: bool IsTimeZoneValid(string countryCode, DateTime localTime); The intention is to determine whether the country has a time zone in which the local time would be valid, given that we know the current UTC time. Let's say, for the sake of argument, that "v...

Time zone conversion C API on Linux, anyone?

I'm looking for something that I presumed would be very simple - given local Unix time in a specific time zone (specified as a string, e.g., "America/New_York" - note that's not my local time), get the corresponding time value in GMT. I.e., something along the lines of time_t get_gmt_time(time_t local_time, const cha...

What is the correct way to handle timezones in datetimes input from a string in Qt

I'm using Qt to parse an XML file which contains timestamps in UTC. Within the program, of course, I'd like them to change to local time. In the XML file, the timestamps look like this: "2009-07-30T00:32:00Z". Unfortunately, when using the QDateTime::fromString() method, these timestamps are interpreted as being in the local timezone. T...

Country to Timezone mapping database

I'm looking at building a form which prompts a user for their timezone. I've looked at the 'Google approach' and it seems to work pretty well. You first select a country from a drop down list and based on the selection, it populates the drop down list with the time zone options. I've search all over for a decent database with a country -...

How to get timezone from properties in CultureInfo

I have a string, which contains a timestamp (yyyy-mm-dd hh:mm:ss). I can create a CultureInfo object based on other information I get. Therefore I know which country the timestamp is in. The timestamp is not in UTC/GMT. Say the timestamp is from Indonesia (new CultureInfo("id-ID")), meaning the string was created by DateTime.Now.ToStrin...

Time zone list issue

For my application, I'm importing the calendar event from google calendar. The only problem which I'm facing is Time zone list. I'm getting the timezone as output from google calendar xml, which I have to check with time zone list and add time accordingly... so from where I can get this standard time zone list.. or some other alternati...

Under what conditions would I want to set a different application-level timezone in rails?

In almost every environment.rb, there's a line for config.time_zone = 'UTC'. What exactly does this line do, and under what circumstances would I want to change it (to, e.g., config.time_zone = 'EST')? ...

UTC and Daylight savings scenario.

I am using UTC to store data and time values in the DB. The values are converted to localtime on the client or per client timezone. I stepped on these scenarios from the MSDN article, where displaying the time from UTC seems to pose issues during daylight savings. Someone living on the east coast of the United States types in a val...

Are time-zones in sync between Windows and .NET

Occasionaly Windows time zones are updated (e.g. http://support.microsoft.com/default.aspx/kb/970653). Does this also updates time zone information inside .NET framework? ...

Why does this rails query behave differently depending on timezone?

I have a rails time-based query which has some odd timezone sensitive behaviour, even though as far as I know I'm using UTC. In a nutshell, these queries give different answers: >> Model.find(:all,:conditions=>['created_at<=?',(Time.now-1.hours).gmtime]).length => 279 >> Model.find(:all,:conditions=>['created_at<=?',(Time.now-1.hours)])...

Mysql date problem in different timezones

Hi, I have been facing this date issue since a long time. Have tried a lot of things but in vain. The problem goes like this: The date entered by the user is '2009-08-12'. It gets stored properly in the db. In the GMT+530 timezone the date gets displayed correctly as well. But when I change the timezone to GMT+1 the date gets displaye...

How would you generate repeateable encryption key?

I am looking to encrypt data. I want to generate encryption keys based on a password, and some moving value, like time. The goal is to have the key change, but have anyone that knows the password be able to decrypt. This is happening in C#. I am using the following code to hash the password. private static string GetPasswordHash(string ...

Convert UTC NSDate to local Timezone Objective-C

Does anyone know how to convert a UTC NSDate to local timezone NSDate in Objective C? ...

How can I determine a timezone by the UTC offset?

I have a scenario where I have a timezone offset (in minutes) and need to determine the timezone for it. I know that all the data is not available (for example, there may be several timezones with an offset of -240 minutes) but a "best guess" is acceptable. My first pass looked like this: foreach (var info in TimeZoneInfo.GetSystemTim...

Date and time handling in applications serving clients in multiple time-zones?

The internationalization problems associated with string handling can pretty much be solved by following the advice: use Unicode and store everything as UTF-8 in your database, then you'll be able to serve clients using all the world's languages. But what about the internationalization problems associated with date/time handling? Quest...

Hibernate Timestamp with Timezone

I'm new to Hibernate and am working with an Oracle 10g database. We have columns in our tables that are of type TIMESTAMP WITH TIMEZONE. Hibernate does not seem to support this mapping directly. Is there a standard way to go about this? Thanks ...

Python - Timezones

Hey Is it possible with python to set the timezone just like this in php: date_default_timezone_set("Europe/London"); $Year = date('y'); $Month = date('m'); $Day = date('d'); $Hour = date('H'); $Minute = date('i'); I can't really install any other modules etc as I'm using shared web hosting. Any ideas? ...

How to get the current date and time of your timezone in Java?

I have my app hosted in a London Server. I am in Madrid, Spain. So the timezone is -2 hours. How can I obtain the current date / time with my time zone. Date curr_date = new Date(System.currentTimeMillis()); e.g. Date curr_date = new Date(System.currentTimeMillis("MAD_TIMEZONE")); With JODA DateTimeZone zone = DateTimeZone.forI...

How to do timezones? In asp.net mvc

Hi on my site I need to know what timezone people are from to display messages to them at the right times. So I am not too sure what to be searching for a tutorial how to do this. So what I am planning to do is a user will come to my site and they will set their timezone by selecting in from a drop down list. I will store their settin...

How can I synchronize time zone info across SharePoint site collections?

We are building a large SharePoint 2007 installation with several hundred site collections over four regionally hosted Web applications. We have approximately 12,000 users, spread out more or less evenly around the globe, and each user may visit many site collections - both on their "home" regional server and on other regional servers....