dst

How to make Time::Piece respect DST when converting localtime to UTC?

拜拜、爱过 提交于 2019-12-07 01:21:29
问题 I want to convert a timestamp from localtime to GMT. I have legacy code that does this "manually" with Time::Local::timelocal() and gmtime . It works, but I don't like it and wanted to use Time::Piece instead. I used this answer to do so (albeit they are converting the other way round, but I was able to replace + with - :-)). This is my code: #!/usr/bin/env perl use strict; use warnings; use Time::Local; use Time::Piece; use POSIX qw(strftime); sub local_to_utc_timelocal { my $local_ts =

Oracle's date and time without daylight savings via JDBC

筅森魡賤 提交于 2019-12-06 15:54:13
问题 Issuing the following SQL generates different results thru PL/SQL, ODBC and JDBC: select sysdate from dual When running it on PL/SQL or ODBC, the date and time is correct. On JDBC it comes with an hour less. It seems that it is not considering daylight savings. For example, on PL/SQL the result is 2012-11-05 16:53:53.0 and on JDBC it is 2012-11-05 15:53:53.0 . It happens only on some databases. Changing the database timezone ( select dbtimezone from dual ) doesn't seems to affect the results.

Java Date and Daylight Saving

丶灬走出姿态 提交于 2019-12-06 13:58:49
I'm trying to print all the hours of the day using a for loop and incrementing a Date object. But I can't have "Sun Mar 25 02:00:00", I only have these: Sun Mar 25 01:00:00 CET 2012 Sun Mar 25 03:00:00 CEST 2012 Sun Mar 25 03:00:00 CEST 2012 Sun Mar 25 04:00:00 CEST 2012 Sun Mar 25 05:00:00 CEST 2012 I'm not interested in having the TimeZone. I think that the problem is due to the Daylight Saving, but I need the "Sun Mar 25 02:00:00". How can I do to create that date? You probably want a DateFormat object that is set up for UTC (which does not observe daylight savings), using a calendar set to

How to set daylight saving to off in php

て烟熏妆下的殇ゞ 提交于 2019-12-06 13:08:16
I've got this line of code which set daylight saving "On" what would be the proper way to set it to "off" // is daylight saving On? $rcmail_config['dst_active'] = (bool)date('I'); date('I') (that's a capital letter i) returns 1 when the current default time zone is in DST. If it's returning 1 instead of 0 and the timezone in question is not in DST , either the timezone you've picked is incorrect or the time zone data it uses is out of date. If you can, please try using a DateTime object with a DateTimeZone object that has been set to the proper time zone . A format('I') call on the resulting

Historical daylight savings in Windows

最后都变了- 提交于 2019-12-06 11:48:05
Is there a easy way in Windows (using Delphi, not .NET) to convert UTC times to a local time, with daylight saving adjustments. Data goes back 12 years, so needs to take account of changes in DST start/end dates over that time. Funny, a very similar question appeared yesterday on LinkedIn. This is the answer I gave there: Time Zones are somewhat fluid, especially when Daylight Saving Time starts/finishes. This database ( http://en.wikipedia.org/wiki/Tz_database ) defines the time zones, and it changes sometimes, so you need an update mechanism as well. There is a .NET implementation that you

Duration with daylight saving

不羁的心 提交于 2019-12-06 11:33:54
I have an object Shift , with two fields: startDateTime and endDateTime as DateTime from Joda-Time. And my shift includes Daylight Saving UK change. It starts on 25/03/2017 13:00 and ends on 26/03/2017 02:00 (basically should end on 26/03/2017 01:00 , but this date does not exists, and endDate is shifted +1 hour). According to this site : When local standard time was about to reach Sunday, 26 March 2017, 01:00:00 clocks were turned forward 1 hour to Sunday, 26 March 2017, 02:00:00 local daylight time instead. Now if I want to track the number of hours worked by a employee new Duration

How to get the time zone name for a CLLocation

て烟熏妆下的殇ゞ 提交于 2019-12-06 10:41:50
I have an application that uses a CLGeocoder to forwardGeocode a placemark from an address string. The CLPlacemark response contains a CLLocation which gives me GPS coordinates. The only way to create an NSTimeZone seems to be by using the correct Time Zone Name. It is important to point out that I am not using the current location of the device, so [NSTimeZone localTimeZone] will not work for me. Is there a way to get the timezone name for the CLLocation so that I can create an NSTimeZone correctly? NOTE: I have been using timeZoneForSecondsFromGMT but that never contains correct DST data, so

is c mktime different on Windows and GNU/Linux?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 08:39:55
问题 the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/time.h> static const char * wday_abb_names[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", }; static void mb_setenv(const char *name, const char *value) { #if !(defined _WIN32) || defined HAVE_SETENV setenv(name, value, 1); #else int len = strlen(name)+1+strlen(value)+1; char *str = malloc(len); sprintf(str, "%s=%s", name, value); putenv(str); #endif } static void mb_unsetenv

Generating a schedule that works over different timezones and DSTs

大憨熊 提交于 2019-12-06 08:32:19
I'm building a web app that coaches people to rise earlier, it generates a rising schedule for the user over a seventy day period. They input their current rising time and their target rising time. The rising time then diminishes a set amount on a weekly basis until it reaches the target time. The user has to login to the website and 'check in' at their scheduled time. I'm at a bit of a loss as to how I generate this plan, taking into account the timezone and DST of the currently logged in user. My starting timezone is the 'neutral' UTC, here's the code for generating the plan, (quite verbose

Is there a daylight savings check in Swift?

爷,独闯天下 提交于 2019-12-06 07:30:32
问题 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. 回答1: 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