dst

Java daylight saving time does not work for distant past (UPDATE: It does)?

拜拜、爱过 提交于 2019-12-14 01:45:39
问题 The following piece of code: TimeZone.getTimeZone("Europe/Athens").inDaylightTime(new Date(200, 8, 14)); returns true , much like it does for the year 2011. However, Daylight Saving Time (DST) was only proposed 100 years or so ago, and applied even more recently. Is the time in the year 200 considered DST, or is this a Java quirk? 回答1: You are mistaken. It works as expected when you use the date new Date(-1700, 8, 14) (which is year 200 ). The constructor you are using is adding 1900 to your

Programmatically get the time at clock-change [closed]

旧时模样 提交于 2019-12-13 23:04:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . i am confused about timezone and countrys at time-changes. Carlifornia changes the time at 10am, NewYork at 7am. How can i programmatically get informations when the time will change next in California? 回答1: To find out DST transitions, you could access Olson timezone database e.g., to find out the time of the

.NET TimeZoneInfo wrong about Morocco daylight savings

本小妞迷上赌 提交于 2019-12-13 17:57:35
问题 Disclaimer While this question looked like a potential duplicate, it was resolved by referring to IsAmbiguousTime . This does not solve my problem, as the time where I'm noticing discrepancies is not reported to be ambiguous. The question, then... While timeanddate.com says Morocco observes daylight savings between April 3 and July 31 this year, and the current time as provided by worldtimeserver.com seems to imply that this is the case, the .NET TimeZoneInfo does not report Casablanca time

Java JSpinner.DateEditor working with TimeZone March clock change

我的未来我决定 提交于 2019-12-13 17:44:01
问题 I have a problem with the standard JSpinner.DateEditor (as probably does everyone else). When it works with the Java.util.Date class, it only gets a default format from the Locale set on the spinner. It appears to be TimeZone ignorant. When we have a Date that is on the March Clock change day which in the UK has no 2 o'clock - the time jumps from 01:59:59.999 AM to 03:00 AM with day light savings applied. Therefore in the JSpinner.DateEditor I do not want the user to see anything for 02:00 to

POSIXct times around DST?

半世苍凉 提交于 2019-12-13 14:20:41
问题 I want to subtract 1 day from a POSIX date and end up at the same time around DST. For example, when I add a day: > as.POSIXct('2009-03-08 23:00:00.000') + 86400 [1] "2009-03-09 23:00:00 EDT" But when I go past, it offsets: > as.POSIXct('2009-03-08 23:00:00.000') - 86400 [1] "2009-03-07 22:00:00 EST" What's the best way to deal with absolute time differences around DST? Usually I deal with this by converting the times into strings and dealing with them separately so that DST isn't applied.

Objective C - How to get raw offset (without DST) using NSTimeZone

旧时模样 提交于 2019-12-13 07:51:16
问题 I'd like to get raw offset from GMT. I know the answer could be like that: NSTimeZone *zone = [NSTimeZone timeZoneWithName:@"Europe/Berlin"]; NSInteger *offset = [zone secondsFromGMT]; (like here: iOS - How to get raw offset for timezone?) But the problem is, it doesn't give me raw offset (for Berlin +1), but only offset with DST (+2), that is, for the current date. 回答1: NSTimeZone has a property daylightSavingTimeOffset which returns the difference to the raw offset NSTimeZone *zone =

Get current week start/end date with DST

坚强是说给别人听的谎言 提交于 2019-12-13 04:41:43
问题 I was using the following code for some months now without any issue in order to get the current week start/end date (Monday/Sunday): date_default_timezone_set('Europe/Bucharest'); //this is the default in php.ini $monday = strtotime('next Monday -1 week'); $monday = date('w', $monday)==date('w') ? $monday+7*86400 : $monday; $sunday = strtotime(date("Y-m-d",$monday)." +6 days"); echo "Current week start/end date:<br>"; echo $this_week_sd = date("Y-m-d",$monday)."<br>"; echo $this_week_ed =

How to subtract two dates, ignoring daylight savings time in PHP?

…衆ロ難τιáo~ 提交于 2019-12-13 00:36:14
问题 I'm trying to calculate the number of days between two days, but I'm running into issues with Daylight Savings Time. Here's my code: function date_diff($old_date, $new_date) { $offset = strtotime($new_date) - strtotime($old_date); return $offset/60/60/24; } Works fine as long as the days are both within the same DST period: echo date_diff('3/15/09', '3/18/09'); // 3 But not if they're further apart: echo date_diff('11/15/08', '3/18/09'); // 122.95833333333 I want an even number of days, and

Properly handle TIME WITH TIME ZONE in PostgreSQL

梦想的初衷 提交于 2019-12-12 16:28:55
问题 We have a table that is filled with data from a legacy report of another system. The columns of that table reflect the same structure of the report. Here are a abbreviated structure of the table: CREATE TABLE IF NOT EXISTS LEGACY_TABLE ( REPORT_DATE DATE NOT NULL, EVENT_ID BIGINT PRIMARY KEY NOT NULL, START_HOUR TIMESTAMP WITHOUT TIME ZONE, END_HOUR TIME WITHOUT TIME ZONE, EXPECTED_HOUR TIME WITHOUT TIME ZONE ); We are refactoring this table to deal with different time zones of different

Handle Daylight Saving in Tomcat without server restart

吃可爱长大的小学妹 提交于 2019-12-12 15:27:42
问题 I have a Java web application running on Tomcat to create scheduled events for a client. I have a question regarding the default date time for underlying operating system, Tomcat and JVM. When I retrieve the Date through the Java code it is similar to the underlying operating system. Then I changed the operating system time just to simulate the Daylight Saving effect, but the application does not reflect the operating system time. Then I read more about it and found that the JRE is