dst

How to get correct number of hours between Joda dates?

允我心安 提交于 2019-12-02 01:29:24
I want to get all the Daylight Saving Time (DST) hours between two dates. This is my example code: public static void main(String[] args) { Date startDate = new Date(); Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(startDate); startCalendar.set(2014, 2, 1, 0, 0, 0); startCalendar.set(Calendar.MILLISECOND, 0); Date endDate = new Date(); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(endDate); endCalendar.set(2014, 2, 31, 0, 0, 0); endCalendar.set(Calendar.MILLISECOND, 0); DateTime startDateTime = new DateTime(startCalendar); DateTime endDateTime =

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

孤街醉人 提交于 2019-12-02 00:07:41
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 simply waits 24 hours - no matter if the clock has changed. It just waits it's specified period and

.NET TimeZoneInfo wrong about Daylight savings

亡梦爱人 提交于 2019-12-01 19:32:30
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 isDaylight = easternTime.IsDaylightSavingTime(); Here are 2 websites saying it is in daylight savings:

.Net DateTime with local time and DST

纵然是瞬间 提交于 2019-12-01 18:48:39
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); DateTime c = new DateTime(2015, 03, 29, 02, 30, 00, DateTimeKind.Unspecified); DateTime d = new DateTime

How to convert a historical timestamp to a different time zone with DST in Delphi?

自作多情 提交于 2019-12-01 18:09:20
I need to convert a historical timestamp from GMT to BST in Delphi (Win32). I can't use the current regional settings in the OS to do the conversion because it won't have the correct daylight saving (DST) offset for the historical time. Is there a VCL API or Win32 API I can use? Delphi TZDB may be of use. It's main feature is that has a class that handles times using the tz database , which, if it contains "historical enough" data, would let you use UTC as an intermediary. The tz database aims to have rules for all the time zones throughout the world and the various time shifts for things like

How to convert a historical timestamp to a different time zone with DST in Delphi?

元气小坏坏 提交于 2019-12-01 18:03:14
问题 I need to convert a historical timestamp from GMT to BST in Delphi (Win32). I can't use the current regional settings in the OS to do the conversion because it won't have the correct daylight saving (DST) offset for the historical time. Is there a VCL API or Win32 API I can use? 回答1: Delphi TZDB may be of use. It's main feature is that has a class that handles times using the tz database, which, if it contains "historical enough" data, would let you use UTC as an intermediary. The tz database

Get the next date/time at which a daylight savings time transition occurs

三世轮回 提交于 2019-12-01 15:37:22
I would like to write (or use if it already exits) a function in C# that returns the date/time of the next DST transition given a System.TimeZoneInfo object and a particular "as of" time in that time zone. The time returned should be in the provided time zone. The function I want has this signature: public DateTime GetNextTransition(DateTime asOfTime, TimeZoneInfo timeZone) { // Implement me! } For example, if I pass in the "Eastern Standard Time" TimeZoneInfo object, and 1/21/2011@17:00 as the "asOfTime", I expect this function to return 3/13/2011@2:00. The System.TimeZoneInfo.TransitionTime

Blackberry date time string formatting

不想你离开。 提交于 2019-12-01 12:51:51
I need to parse the date/time string, to add the raw offset and convert it according to local time zone. The date time that I get from server is in this format : "05-25-2012 02:30 PM" This format is not parsed by : HttpDateParser.parse(time) method But HttpDateParser does parse this format : "25-MAY-2012 02:30 PM" Can you tell me, how should I parse "05-25-2012 02:30 PM" String in BB to get a long value. I have 1 more problem, I need to display time zone in format GMT, IST, but all I can display is Asia/Calcutta, America/Los_Angeles and so.. BlackBerry Java is missing some useful String

R - UTC to LOCAL time given Olson timezones

独自空忆成欢 提交于 2019-12-01 10:35:16
I have time series data from 1974-2013 with a column for datetimeUTC (YYYY-MM-DD hh:mm +0000), and a column for the timezones in Olson format (e.g., Canada/Pacific, Canada/Eastern). I can convert the whole UTCdatetime column to a common timezone like this: dataset$datetimeEST <- strptime( dataset$datetimeUTC, format="%Y-%m-%d %H:%M:%S%z", tz="Canada/Eastern" ) How do I convert datetimeUTC to datetimeLOCAL , given the corresponding timezone in each row? Let me back up a bit. I have data from across the country (6 timezones) formatted in ISO8601 representation for 1974-2013. The timestamps are

python pandas TimeStamps to local time string with daylight saving

醉酒当歌 提交于 2019-12-01 09:19:40
I have a dataframe with a TimeStamps column. I want to convert it to strings of local time, ie with daylight saving. So I want to convert ts[0] below to "2015-03-30 03 :55:05". Pandas seems to be aware of DST, but only when you call .values on the series. Thanks (Pdb) ts = df['TimeStamps'] (Pdb) ts 0 2015-03-30 02:55:05.993000 1 2015-03-30 03:10:20.937000 2 2015-03-30 10:09:19.947000 Name: TimeStamps, dtype: datetime64[ns] (Pdb) ts[0] Timestamp('2015-03-30 02:55:05.993000') (Pdb) ts.values array(['2015-03-30T03:55:05.993000000+0100', '2015-03-30T04:10:20.937000000+0100', '2015-03-30T11:09:19