timezone

How do I create a unix timestamp that doesn't adjust for localtime?

So I have datetime objects in UTC time and I want to convert them to UTC timestamps. The problem is, time.mktime makes adjustments for localtime. So here is some code: import os import pytz import time import datetime epoch = pytz.utc.localize(datetime.datetime(1970, 1, 1)) print time.mktime(epoch.timetuple()) os.environ['TZ'] = '...

Getting timezone information on iPhone for coordinates

For iPhone development: How can I get the timezone and DST information for any place given that I only have geographic coordinates. (NSTimezone does not have any such method) ...

Java time calculation problem

Hi, I need to solve below using java 6 api. The inputs are start time , end time and a given time t in a given time zone . All Times must be in 24 hr format = HH:mm The program must return values x such that: f(t)= 0 , for start<=t<=end = x , for t outside start and end where x is the interval in seconds fo...

Best way to convert Unix time_t to/from abitrary timezones?

My code receives a time_t from an external source. However, that time_t isn't acutally based on UTC Epoch time, along with it I get a timezone string (eg, EDT, PST, etc), and its based on this offset'ed epoch. I need to convert this to a true UTC Epoch based time_t. Additionally, I need to be able to go in the opposite direction, taking...

validate time GMT offset and striping with regex ?

// create a string $string = '+7'; // try to match the beginning of the string if(preg_match("{-15 to +12}", $string)) { // if it matches we echo this line return {strip all the + sign} echo 'its a valid gmt time'; } else { echo 'not valid gmt time'; } Question: please see the first {} on preg_match, ...

Json returns different dates when local machine and server in different timezones

I have a strange problem in json date parsing. I am using the following to parse the json date: dateFormat(new Date(parseInt(user.RegDate.substr(6))), "mm/dd/yyyy") When my local machine (Client) is in different timezone from the server timezone, then it returns different dates when i try to retrieve the registered date of the users. ...

Timezone display in java

I need to display timezone in the following format in my UI. (GMT -05:00) Eastern Time(US & Canada). I tried getting the current time and timezone from calendar. But when i tried to get the display name from timezone it just displays as "Eastern time". I am not getting the format mentioned above. Can anyone help. Following is my c...

Getting current time of a different timezone using C++

How do i get the current time of a different time zone? Example, i need to know the current time in Singapore where as my system is set to PT time. ...

Getting local time

I've got this time stored as a string: 2010-07-25 04:16:25 This is the GMT time for some action I took. Since I live in the Jerusalem time zone, I would like to show it at Jerusalem time, i.e. 07:16 in the morning, not the GMT time of 04:16:25 which is 3 hours before. How do I properly convert it programmatically with Ruby on Rails? ...

C# DateTime time zone subtract issues

I have this line of code: double seconds = new DateTime(2006,7,6,12,1,0,DateTimeKind.Local).Subtract(new DateTime(1970,1,1,0,0,0,DateTimeKind.Local).TotalSeconds; This was not the right number I wanted, so I tried the following: double seconds = new DateTime(2006,7,6,12,1,0,DateTimeKind.Local).Subtract(new DateTime(1970,1,1,0,0,0,Dat...

to compare Indian time

I want to find out what will be the time in india when clock tick to 1Am mid night in any other country.. How i will find out that through any means plz help me to find out this this is to fire birthbay mails at 1AM midnight of that resp country... ...

[CakePHP] Timezone and more problems with Cakephp 1.3 and PHP 5.3.2

hi all, on server i have php 5.3.2, and cakephp 1.3. when i run cakephp application, it gives me following errors: Warning (2): strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In c...

What is the best way to collect a user's timezone without explictly asking the user ?

For my project(a web and iPhone based application) i need to collect a user's timezone so as to show him/her the relevant data.Some of the possibilities that I can think of are : 1.Getting it using user's IP (But what if the user is behind a proxy server) 2.Sending it with request params(But that will require extra param to be attached ...

Dealing with timezones in Django

I'm trying to deal with timezone information in Django. I tried doing something like: results = Competitor.objects.raw("SELECT official_start AT TIME ZONE 'UTC', official_finish AT TIME ZONE 'UTC' FROM competitor WHERE race_id=1") Thinking that this way I would know that the timezone was UTC but say I store a time in the database that...

Using custom sql in Django

Is there a way to run a custum SQL statement in Django? I have some timestamp fields in my database that have timezone information. Normally you could just enter the time in a format like: 2010-7-30 15:11:22 EDT and in my case postgresql will figure it out. But in Django it treats timestamps as Datetimes which don't store timezone inform...

C# read timezone from string and convert to local

I've looked and looked and can't seem to come up with the perfect solution. So, since stack overflow is perfect, this will cure my problem. I'm getting System.String datetimes from a server (Microsoft CRM if you care). They're in SQL format ("2010-07-23T17:14:40-04:00"). I want to read that in as a .net System.DateTime type with the ...

How to display converted time zones in a 'generic week' (Sunday thru Saturday)?

Hi, We are building a scheduling application wherein one user may set his "general availability" for all weeks like the following: Sunday | Monday | ... | Friday | Saturday When we ask a person A in India to indicate his "availability", we ask him to select from a drop down of values something like this: 12:00am 12:30am 01:00am ... ...

grails/mysql timezone change

Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: Server TZ is changed by sys admin mysql must be restarted. every time based column in the database must have all values updated, using convert_tz or equivalent. So either a mysql script must be written or a grails script that ...

NSDate formatting using locale

Hi All, I was using the following method for creating NSDate Object based on the timezone and locale. descriptionWithCalendarFormat:timeZone:locale: [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timezone:nil locale:nil]; But this method is no mo...

what date/time considerations when we create event based site?

hi, I would like to know how to handle date and time if we do any site where we ask users to create evetns like evite.com. my confusion is, if I create an event for Aug 5th and then invite 200 persons from different places(outside the event country), how evite sends the reminder because the time is different in some countries i.e. it wi...