dst

How to tell if a timezone observes daylight saving at any time of the year?

我的未来我决定 提交于 2019-11-26 17:43:31
问题 In PHP, you can tell if a given date is during the Daylight Savings Time period by using something like this: $isDST = date("I", $myDate); // 1 or 0 The problem is that this only tells you whether that one point in time is in DST. Is there a reliable way to check whether DST is in effect at any time in that timezone? Edit to clarify: Brisbane, Australia does not observe daylight savings at any time of the year. All year around, it is GMT+10. Sydney, Australia does, from October to March when

Convert UTC DateTime to another Time Zone

柔情痞子 提交于 2019-11-26 16:05:31
问题 I have a UTC DateTime value coming from a database record. I also have a user-specified time zone (an instance of TimeZoneInfo). How do I convert that UTC DateTime to the user's local time zone? Also, how do I determine if the user-specified time zone is currently observing DST? I'm using .NET 3.5. Thanks, Mark 回答1: Have a look at the DateTimeOffset structure: // user-specified time zone TimeZoneInfo southPole = TimeZoneInfo.FindSystemTimeZoneById("Antarctica/South Pole Standard Time"); // an

Get Daylight Saving Transition Dates For Time Zones in Java

随声附和 提交于 2019-11-26 15:49:31
问题 I'd like to know the simplest way, in Java, to get a list of dates in the future where daylight savings time will change. One rather inellegant way to do this would be to simply iterate over a bunch of years' worth of days, testing them against TimeZone.inDaylightTime(). This will work, and I'm not worried about efficiency since this will only need to run every time my app starts, but I wonder if there's a simpler way. If you're wondering why I'm doing this, it's because I have a javascript

MySQL datetime fields and daylight savings time — how do I reference the “extra” hour?

孤人 提交于 2019-11-26 14:55:12
I'm using the America/New York timezone. In the Fall we "fall back" an hour -- effectively "gaining" one hour at 2am. At the transition point the following happens: it's 01:59:00 -04:00 then 1 minute later it becomes: 01:00:00 -05:00 So if you simply say "1:30am" it's ambiguous as to whether or not you're referring to the first time 1:30 rolls around or the second. I'm trying to save scheduling data to a MySQL database and can't determine how to save the times properly. Here's the problem: "2009-11-01 00:30:00" is stored internally as 2009-11-01 00:30:00 -04:00 "2009-11-01 01:30:00" is stored

Use Python to find out if a timezone currently in daylight savings time [duplicate]

戏子无情 提交于 2019-11-26 14:07:37
问题 This question already has an answer here: Is a specific timezone using DST right now? 1 answer We have a server that runs on GMT time. I need to write a Python script that determines if it's currently (at this very second) Daylight Savings Time (DST) in Los Angeles, CA. How can I accomplish this? I took a look at pytz and time, but I can't figure it out. I realize that I could create some logic such as comparing the current time in LA to GMT time, but it would be a lot cleaner if I could use

Determine Whether Daylight Savings Time (DST) is Active in Java for a Specified Date

烈酒焚心 提交于 2019-11-26 12:43:08
问题 I have a Java class that takes in the latitude/longitude of a location and returns the GMT offset when daylight savings time is on and off. I am looking for an easy way to determine in Java if the current date is in daylight savings time so I can apply the correct offset. Currently I am only performing this calculation for U.S. timezones although eventually I would like to expand this to global timezones as well. 回答1: This is the answer for the machine on which the question is being asked:

Converting Between Local Times and GMT/UTC in C/C++

眉间皱痕 提交于 2019-11-26 10:50:25
问题 What\'s the best way to convert datetimes between local time and UTC in C/C++? By \"datetime\", I mean some time representation that contains date and time-of-day. I\'ll be happy with time_t , struct tm , or any other representation that makes it possible. My platform is Linux. Here\'s the specific problem I\'m trying to solve: I get a pair of values containing a julian date and a number of seconds into the day. Those values are in GMT. I need to convert that to a local-timezone \

Handling dates when we switch to daylight savings time and back

陌路散爱 提交于 2019-11-26 09:51:54
问题 I would like to use R for time series analysis. I want to make a time-series model and use functions from the packages timeDate and forecast. I have intraday data in the CET time zone (15 minutes data, 4 data points per hour). On March 31st daylight savings time is implemented and I am missing 4 data points of the 96 that I usually have. On October 28th I have 4 data points too many as time is switched back. For my time series model I always need 96 data points, as otherwise the intraday

.NET DateTime.Now returns incorrect time when time zone is changed

馋奶兔 提交于 2019-11-26 09:28:08
问题 This problem occurred during daylight saving time change. After the change occurred, we\'ve noticed that our server application started writing into the log incorrect time - one hour ahead which means that .NET caches time zone offset. We had to restart our application to resolve this problem. I wrote a simple application to reproduce this problem. When I change the time zone while application is running, DateTime.Now property keeps producing the time in the old time zone. Does anybody know

Is it always a good idea to store time in UTC or is this the case where storing in local time is better?

自古美人都是妖i 提交于 2019-11-26 08:58:41
问题 Generally, it is the best practice to store time in UTC and as mentioned in here and here. Suppose there is a re-occurring event let\'s say end time which is always at the same local time let\'s say 17:00 regardless of whether there is Daylight saving is on or off for that time zone. And also there is a requirement not to change the time manually when DST turns ON or OFF for particular time zone. It is also a requirement that whenever end time is asked by any other systems through API (i.e.