dst

How to add weekly timedeltas with regards to daylight saving timezones

こ雲淡風輕ζ 提交于 2019-12-04 19:07:18
问题 I want to add or subtract weeks (or days or month or years) to localized datetime objects. The problem is, that the naive approach will result in 1 hour shifts due to daylight saving timezones. 2014-03-27 12:00 is right before the switch from winter to summer time. If I add a timedelta of one week to this date localized in timezone Europe/Berlin for example, the result will be 2014-04-03 13:00. I would like to have the same hour of day, 2014-04-03 12:00. I found a solution: from datetime

Oracle.ManagedDataAccess reads DST dates incorrectly

孤者浪人 提交于 2019-12-04 18:02:42
I am writing a .Net application that runs on top of an Oracle 11.2.0.2.0 database that stores dates in columns of type "TIMESTAMP(6) WITH LOCAL TIME ZONE". When there is a date stored into the column and it falls within DST, the date is read incorrectly when using the Oracle.ManagedDataAccess library. It appears to always write/update dates correctly. Also, when using the Oracle.DataAccess library, it always handles the dates correctly. In my example I am using timezone 'America/New_York' and date/time of 08/01/2014 12:00:00. Here is a snippet of code that reads the date incorrectly:

Is there a daylight savings check in Swift?

∥☆過路亽.° 提交于 2019-12-04 13:56:58
I need to check to see if the current date is during daylight savings time. In pseudocode that would be like this: let date = NSDate() if date.isDaylightSavingsTime { print("Success") } I haven't been able to find the solution to this anywhere on the internet. An NSDate alone represents an absolute point in time. To decide if a date is during daylight savings time or not it needs to be interpreted in the context of a time zone . Therefore you'll find that method in the NSTimeZone class and not in the NSDate class. Example: let date = NSDate() let tz = NSTimeZone.localTimeZone() if tz

Why doesn't subtracting two local DateTime values appear to account for Daylight Saving Time?

久未见 提交于 2019-12-04 12:07:32
I'm playing with some C# code to try to gain an understanding of how subtracting DateTime objects in C# works with respect to Daylight Saving Time. Per Google and other sources, the Daylight Saving Time "spring ahead" event in the Eastern Standard Time zone in 2017 was at 2:00am on March 12. So, the first few hours of the day on that date were: 12:00am - 1:00am 1:00am - 2:00am (There was no 2:00am - 3:00am hour due to the "spring ahead") 3:00am - 4:00am So, if I were to calculate the time differential between 1:00am and 4:00am in that time zone on that date, I'd expect the result to be 2 hours

Get timezone offset for a given location

孤街醉人 提交于 2019-12-04 11:54:13
问题 Is it possible in PHP to get the timezone offset for a given location? E.g. when given the location "Sydney/Australia" to get the timezone offset as "+1100". Bonus would be for this function the keep daylight savings in mind (i.e. it's aware of daylight savings and adjusts the offset according). 回答1: To display a local date/time you can use the following, where 'Europe/Berlin' would be replaced with the user's timezone. $date = new DateTime($value); $date->setTimezone(new DateTimeZone('Europe

DateTime object not bound by its timestamp?

寵の児 提交于 2019-12-04 09:36:53
Is a DateTime object not bound by its timestamp? Or does getTimestamp() has some kind of side-effect when used on DST change? Details When setting the timestamp of a DateTime object which is on DST (meaning the formatted time exists both before/after changing the clock) the returned timestamp differs from the set timestamp. $ php --version PHP 7.1.3 (cli) (built: Mar 17 2017 16:59:59) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies Reproduce Consider the following php script: date_default_timezone_set('Europe/Berlin'); $date = new

How to properly handle Daylight Savings Time in Apache Airflow?

南笙酒味 提交于 2019-12-04 09:34:37
In airflow, everything is supposed to be UTC (which is not affected by DST). However, we have workflows that deliver things based on time zones that are affected by DST. An example scenario: We have a job scheduled with a start date at 8:00 AM Eastern and a schedule interval of 24 hours. Everyday at 8 AM Eastern the scheduler sees that it has been 24 hours since the last run, and runs the job. DST Happens and we lose an hour. Today at 8 AM Eastern the scheduler sees that it has only been 23 hours because the time on the machine is UTC, and doesn't run the job until 9AM Eastern, which is a late

Timer callback raised every 24 hours - is DST handled correctly?

二次信任 提交于 2019-12-04 04:26:30
问题 I just thought about the way I solved a service which runs a task every 24 hours and how DST could possibly hurt it. To run the task daily, I used a System.Threading.Timer with a period of 24 hours, like this: _timer = new System.Threading.Timer(TimerCallback, null, requiredTime - DateTime.Now, new TimeSpan(24, 0, 0)); Suddenly thinking about daylight saving time correction I had three thoughts: DST is useless and we should get rid of it. Does the Timer handle this correctly? I think not - it

.Net DateTime with local time and DST

天大地大妈咪最大 提交于 2019-12-04 03:55:55
问题 I'm afraid I don't really understand how .Net's DateTime class handles local timestamps (I live in Germany, so my locale is de_DE). Perhaps someone can enlighten me a bit ;-) The DateTime constructor can be called with year, month etc. parameters. Additionally a DateTimeKind value of Local , Utc , or Unspecified (=default) can be provided. Example: DateTime a = new DateTime(2015, 03, 29, 02, 30, 00, DateTimeKind.Local); DateTime b = new DateTime(2015, 03, 29, 02, 30, 00, DateTimeKind.Utc);

.NET TimeZoneInfo wrong about Daylight savings

╄→гoц情女王★ 提交于 2019-12-04 03:35:07
问题 Can anyone help make sense of this. Microsoft’s TimeZoneInfo class in 3.5 is telling me the following GMT date is not in Daylight savings for the Eastern timezone, but it is. // Get Eastern Timezone TimeZoneInfo tzEasternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); // Convert to EST DateTime easternTime = TimeZoneInfo.ConvertTime(DateTime.Parse("2009-11-01T05:00:00Z"), tzEasternZone); // Daylight saving IS in effect on this date, but Microsoft doesn't think so Boolean