dst

Check if daylight savings is in effect?

孤人 提交于 2019-11-30 04:22:33
How to check if in Denmark daylight time savings has taken effect, if so, then add 1 hour to my data, else not? I have a xml file: <day = "1" month = "5" sunrise ="06:30" sunset ="21:30" /> Think you need convert this xml to DateTime and then use TimeZoneInfo class. If Denmark your local time: DateTime thisTime = DateTime.Now; bool isDaylight = TimeZoneInfo.Local.IsDaylightSavingTime(thisTime); Else you need to get Denmark TimeZone: DateTime thisTime = DateTime.Now; // get Denmark Standard Time zone - not sure about that TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById("Denmark Standard

Why does this rails query behave differently depending on timezone?

醉酒当歌 提交于 2019-11-30 04:15:38
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)]).length => 280 Where the DB actually does contain one model created in the last hour, and the total number of models is 280. So only the first query is correct. However, in environment.rb I have: config.time_zone = 'UTC' The system time zone (as reported by

does php's date_default_timezone_set adjust to daylight saving?

拜拜、爱过 提交于 2019-11-30 03:33:43
问题 Does php's date_default_timezone_set adjust to daylight saving? I have this code, and wonder if it will always result in the correct Stockholm time? date_default_timezone_set('Europe/Stockholm'); $timestamp = date("Y-m-d H:i:s"); 回答1: Yes this should always result in the right time. 回答2: PHP doesn't handle DST automatically. You have to check if (date('I', time()) == 1) ... the time is in DST mode ("0" = not) Then you should adust time accordingly. (Note: 'I' in capital. I have just checked

Python: How to convert a timezone aware timestamp to UTC without knowing if DST is in effect

本小妞迷上赌 提交于 2019-11-30 01:17:51
问题 I am trying to convert a naive timestamp that is always in Pacific time to UTC time. In the code below, I'm able to specify that this timestamp I have is in Pacific time, but it doesn't seem to know that it should be an offset of -7 hours from UTC because it's only 10/21 and DST has not yet ended. The script: import pytz import datetime naive_date = datetime.datetime.strptime("2013-10-21 08:44:08", "%Y-%m-%d %H:%M:%S") localtz = pytz.timezone('America/Los_Angeles') date_aware_la = naive_date

Python tzinfo and daylight time

泪湿孤枕 提交于 2019-11-29 22:07:42
问题 (I am new to Python and Google App Engine, please forgive me if my questions seem basic). I'm having a helluva time trying to manage multiple user timezones in my Google App Engine application. Here are my constraints: If a user enters the time on an input, it will be local time (including DST, when appropriate). If a user does not enter the time, the system must enter it for them in their local time (including DST, when appropriate). When the date and time are displayed to the user, it must

Javascript date object in different locale and timezone

 ̄綄美尐妖づ 提交于 2019-11-29 21:41:29
问题 I need to write a web application that show events of people in different locale. I almost finished it, but there're 2 problems with date: using date javascript object, the date depends on user computer settings and it's not reliable if there's an event in a place with dfferent timezone respect user current position, i have to print it inside () . Is it possible in javascript to build a date object with a given timezone and daylight settings? I also find some workaround, such as jsdate and

Quartz.NET - Shouldn't this unit test pass?

懵懂的女人 提交于 2019-11-29 21:18:07
问题 This question is related to this one, but is kept more general and can be treated independently. EDIT: Quartz version is v2.0.1 From my understanding, the following unit test should pass: [Test] public void Test() { // run every first day of month at 14:00 hours CronExpression expression = new CronExpression("0 0 14 1 * ?"); // TimeZoneInfo.Local = {(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien} if (!TimeZoneInfo.Local.SupportsDaylightSavingTime) { return; } // get "summertime"

How is java.util.TimeZone daylight info updated?

此生再无相见时 提交于 2019-11-29 16:31:07
I couldn't find a similar question around, so here it goes. I need to create some alerts and basically identify when a daylight saving time approaches, i.e. next thursday daylight begins Question How does Timezone knows the correct info? I ask that because, for instance, in my country - Brazil - the day is defined one year before when it will happen by government. It could potentially not even exist on a specific year. This probably happens in other countries as well. On Java Doc , the below info can be found: This method returns a historically correct offset value if an underlying TimeZone

Determining remote daylight saving in sql server

℡╲_俬逩灬. 提交于 2019-11-29 14:43:32
I want to determine the if daylight saving time is active or not, but in a region different to where my server is located. My problem is I want to check the daylight saving of London and my server is in Canada; is it possible to find the daylight saving of a different time zone? You need to deploy a table of DST and look up the DST time for the region you want. DST are published by various organizations and refreshed periodically. What you need to understand is that DST cannot be determined by an algorithm, it can only be looked up as is set by various legislative bodies for various regions,

Javascript Date objects and Daylight Savings Time

☆樱花仙子☆ 提交于 2019-11-29 14:28:26
I'm seeing some behavior I don't understand with Javascript date objects and DST transitions. If I execute the following in Chrome's javascript console var date = new Date(1268535600000); //2010-03-14T03:00:00.000Z (21:00 03-13 America/Chicago) for(var i = 1; i <= 12; i++) { var time = date.getHours(); console.log(time) console.log(date) date.setHours(date.getHours() + 1); } the output is: 21 Sat Mar 13 2010 21:00:00 GMT-0600 (Central Standard Time) 22 Sat Mar 13 2010 22:00:00 GMT-0600 (Central Standard Time) 23 Sat Mar 13 2010 23:00:00 GMT-0600 (Central Standard Time) 0 Sun Mar 14 2010 00:00