timezone

How do I use SafeHandle to safely use TimeZoneInfo with SQL CLR?

I am trying to use .NET TimeZoneInfo class from a SQL CLR function, as described in stackoverflow questions here and here. While researching possible solutions, I found this post that suggests using SafeHandle to safely handle the resources accessed by TimeZoneInfo. How do I use SafeHandle in this situation? ...

Struggling with how to compare hours with different time zones in Java?

Hi! I have 2 date object in the database that represent the company's working hours. I only need the hours but since I have to save date. it appears like this: Date companyWorkStartHour; Date companyWorkEndHour; start hours: 12-12-2001-13:00:00 finish hours: 12-12-2001-18:00:00 I have the timezone of the company and of the user. (...

Converting time from UTC to Local and vice versa

Hi I am trying to figure out a way to convert a FILETIME structure from UTC to Local and vice versa. I've been using the two functions: FileTimetoLocalFileTime() and LocalFileTimeToFileTime(). The problem seems that they do not work as expected. As an example: First I got a local file time using: WIN32_FIND_DATA fd; FindFirstFile(_T...

ruby get Time in given timezone

In ruby, how can I get current time in a given timezone? I know the offset from UTC, and want to get the current time in the timezone with that offset. ...

Working with the Grails g:timeZoneSelect tag?

I am wanting to use the g:timeZoneSelect tag within my application, problem is im finding the resulting html select to be quite overwhelming. Over 600 options are being displayed, IMHO this is to much to display to the user. Maybe someone could point me to an example of a much more manageable list of timezones? Maybe you have seen a si...

PHP Time Zone Adjustment

I have a time that is being sent to me in UTC time, but I want to adjust it so its the outer edges of the days on East Coast time (EST/EDT). That is, I want the user to be able to enter in EDT/EST centric dates, and have it query with the UTC correct dates. $start_date and $end_date are MM/DD/YYYY formatted dates passed via a GET varia...

How do I get the current time zone of MySQL ?

Anyone knows if there is such a function in MySQL? UPDATE This doesn't output any valid info: mysql> SELECT @@global.time_zone, @@session.time_zone; +--------------------+---------------------+ | @@global.time_zone | @@session.time_zone | +--------------------+---------------------+ | SYSTEM | SYSTEM | +------...

How do I show datetime in the same time zone as user using PHP or javascript?

Suppose now I've got the datetime to show like this: 2010-05-29 15:32:35 The the corresponding time zone can be get by date_default_timezone_get, how do I output the result in the same time zone as user's browser so that users don't get confused? ...

Why does Rails screw up timezones when I am editing a resource?

Steps to produce this: prompt>rails test_app prompt>cd test_app prompt>script/generate scaffold date_test my_date:datetime prompt>rake db:migrate now edit your app/views/date_tests/edit.html.erb: <h1>Editing date_test</h1> <% form_for(@date_test) do |f| %> <%= f.error_messages %> <p> RIGHT!<br/> <%= text_field_tag @date_...

Why doesn't the Timezone change when I set the CurrentCulture?

From what I have researched it is not possible to change the Timezone of a thread. So my question is why can't you? I would have thought switching your application's culture to a specific country would also switch this, seems like expected behaviour IMO. Edit After revising I can see the reason why it probably shouldn't be mapped 1:1 ...

How to control Time zone formatting in System.Xml.Serialization or during application execution?

I'm developing a C# .Net Application that is executing on a system located in the Central Time Zone. The application gets information from a third party using an API they provide. I have used the WSDL to produce the code that my application access the API with...their reporting API allows you to define a start date and end date for the r...

Rails 3 Timezone error

I am struggling with time zone support in Rails 3 beta and I would like to know if it is a bug or if I am doing something wrong. He is the problem: > Time.zone = 'Madrid' # it is GMT+2 => "Madrid" > c = Comment.new => #<Comment id: nil, title: "", pub_at: nil> > c.pub_at = Time.zone.parse('10:00:00') => Mon, 31 May 2010 10:00:00 C...

Using timezone 'EST' in freemarker template

<#setting time_zone="America/New_York"> Time: ${response.currentDate?string("MM/dd/yyyy hh:mm a zzz")}. I need the timezone to be displayed as 'EST'. But currently, when i run the application and the email gets generated from the template above, it is displaying as 'EDT'. Can you please let me know what needs to be done to show as 'ES...

system time is different than apache timestamp -- ?

Im on a development server. When i do this in php: echo date('r',time()); response: Tue, 01 Jun 2010 18:10:32 -0400 However, my computer's time is 17:10:32 (im on GMT -5). Where do i configure my apache/php to change this setting? i've looked in php.ini and httpd.conf already. Thanks ...

Python - calendar.timegm() vs. time.mktime()

I seem to have a hard time getting my head around this. What's the difference between calendar.timegm() and time.mktime()? Say I have a datetime.datetime with no tzinfo attached, shouldn't the two give the same output? Don't they both give the number of seconds between epoch and the date passed as a parameter? And since the date passed...

How to use TimeZoneInfo to get local time during Daylight Savings Time?

I'm trying to use DateTimeOffset to convey a specific moment in time across any time zone. I can't figure out how to use TimeZoneInfo to deal with daylight savings time. var dt = DateTime.UtcNow; Console.WriteLine(dt.ToLocalTime()); var tz = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); var utcOffset = new DateTimeOffs...

Get Rails to save a record to the database in a non-UTC time

Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is th...

I'm 532 hours away from GMT????

iPhone, Xcode, Objective-c: NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease]; [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSString *s = @"1902-02-01 01:00:00"; NSDate *aDate = [df dateFromString:s]; NSLog(@"(%@)", aDate); // (1902-02-01 01:00:00 -053211) Wow.. 532 hour timezone offset? ...

.NET Get timezone offset by timezone name

Hello, In database I store all date/times in UTC. I know user's timezone name ("US Eastern Standard Time" for example). In order to display correct time I was thinking that I need to add user's timezone offset to UTC date/time. But how would I get timezone offset by timezone name? Thank You! ...

PHP/MySQL time zone migration

I have an application that currently stores timestamps in MySQL DATETIME and TIMESTAMP values. However, the application needs to be able to accept data from users in multiple time zones and show the timestamps in the time zone of other users. As such, this is how I plan to amend the application; I would appreciate any suggestions to im...