dst

javascript seems to be using time zones backwards with Firefox

。_饼干妹妹 提交于 2019-11-29 10:49:01
I've run the following in the console on Firefox (version 21) and I'm getting results I don't expect. new Date(1362891600000); var date = new Date(1362891600000); var time = date.getHours(); new Date(date.setHours(date.getHours() + 24)); The result really throws me for a loop. The first date shows up as Eastern Daylight Time, while the second one shows up with Eastern Standard Time. It's totally backwards. This does not happen with IE or with Chrome. What's going on here? This is definitely a bug in Firefox. You should probably report it to them. However, be aware that anything after the

PHP Daylight savings conundrum

喜你入骨 提交于 2019-11-29 10:16:38
I have a general question about dealing with daylight saving time. I guess its not really PHP specific, but I am writing in PHP, so I figure it wouldn't hurt to include it. I have a calendar app built using jquery fullcalendar. The user views events in their local timezone and my server stores them as UTC datetimes in mysql. (Other questions on stackoverflow suggest that this is the best way to deal with timezones.) So there is a conversion every time the user saves or views events on the calendar. This is working fine, but I am confused about how best to deal with daylight saving time. For

jodatime how to know if daylight savings is on

谁都会走 提交于 2019-11-29 09:45:00
I have an API that needs the timezone. For eg. if I am in california, I need to pass -7 to it when daylight savings is on (California , PDT is GMT - 7) and -8 to it when daylight saving is off. But I am not able to figure out a way of knowing whether on the current date, daylight saving is on or off. Date date1 = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date1); double[] coords = db.getCoords(id1); double latitude = coords[0]; double longitude = coords[1]; double timezone = -7; /* For Pacific daylight time (GMT - 7)*/ ArrayList<String> Times = Class.foo(cal, latitude,

org.joda.time | Day Light Saving time (DST) and local time zone offset

十年热恋 提交于 2019-11-29 07:28:26
just to verify this: I have this lame and brain dead method to calculate the time zone offset for my current location. I wonder if I need to adjust it when Day Light Saving time comes into question (currently we have Winter Time at my location, CET time zone, so it's hard to verify). // The local time zone's offset private int getLocalOffset() { DateTimeZone defaultZone = DateTimeZone.getDefault(); return defaultZone.getOffset(null) / 1000 / 60 / 60; } Thanks for any hint. Normally, Joda time will take care of DST by itself, so you don't have to worry about it. However, I notice that you are

PHP date_default_timezone_set() Eastern Standard Time (EST)

拜拜、爱过 提交于 2019-11-29 06:03:56
Long story short Is there an official, un-deprecated timezone that PHP5 recognizes for Eastern STANDARD time--not Eastern DAYLIGHT time? Short story long :-P Wow, I can't believe that PHP makes such a cluster-floogen out of setting the time. I would like to use PHP5's date_default_timezone_set() to set the timezone for my script. I want to use standard time. I do not want my script to observe daylight savings time. I do not want to have to use gmtime() and subtract 60*60*5 seconds each time my program writes a time. I don't want to save that value to a variable either. Setting the default

Make Rails ignore daylight saving time when displaying a date

久未见 提交于 2019-11-29 05:09:19
I have a date stored in UTC in my Rails app and am trying to display it to a user who has "Eastern Time (US & Canada)" as their timezone. The problem is that rails keeps converting it to Eastern Daylight Time (EDT) so midnight is being displayed as 8am when it should be 7am . Is there anyway to prevent the DST conversion? >> time = DateTime.parse("2013-08-26T00:00:00Z") => Mon, 26 Aug 2013 00:00:00 +0000 >> time.in_time_zone("Eastern Time (US & Canada)") => Sun, 25 Aug 2013 20:00:00 EDT -04:00 Update I eventually went with a twist on @zeantsoi 's approach. I'm not a huge fan of adding too many

Import date-time at a specified timezone, disregard Daylight Savings Time

主宰稳场 提交于 2019-11-29 04:08:20
I have time series data obtained from a data logger that was set to one time zone without daylight savings ( NZST or UTC+12:00), and the data spans a few years. Data loggers don't consider DST changes, and are synchronized to local time with/without DST (depending who deployed it). However, when I get the data into R, I'm unable to properly use as.POSIXct to ignore DST. I'm using R 2.14.0 on a Windows computer with these settings: > Sys.timezone() [1] "NZDT" > Sys.getlocale("LC_TIME") [1] "English_New Zealand.1252" Here are three timestamps across the spring DST change, each are spaced 1 hour

How do I write unit tests to make sure my date/time based code works for all time zones and with/out DST?

有些话、适合烂在心里 提交于 2019-11-29 02:38:40
问题 I'm using JodaTime 2.1 and I'm looking for a pattern to unit test code which performs date/time operations to make sure it behaves well for all time zones and independent of DST. Specifically: How can I mock the system clock (so I don't have to mock all the places where I call new DateTime() to get the current time) How can I do the same for the default time zone? 回答1: You can use a @Rule for this. Here is the code for the rule: import org.joda.time.DateTimeZone; import org.junit.rules

Getting Daylight Savings Time Start and End in NodaTime

家住魔仙堡 提交于 2019-11-29 01:59:24
How can I get the starting and ending dates for Daylight Savings Time using Noda Time? The function below accomplishes this task but it is horribly unwieldy and is begging for a simpler solution. /// <summary> /// Gets the start and end of daylight savings time in a given time zone /// </summary> /// <param name="tz">The time zone in question</param> /// <returns>A tuple indicating the start and end of DST</returns> /// <remarks>Assumes this zone has daylight savings time</remarks> private Tuple<LocalDateTime, LocalDateTime> GetZoneStartAndEnd(DateTimeZone tz) { int thisYear = TimeUtils

Check if daylight savings is in effect?

怎甘沉沦 提交于 2019-11-29 01:38:48
问题 How to check if in Denmark daylight time savings has taken effect, if so, then add 1 hour to my data, else not? I have a xml file: <day = "1" month = "5" sunrise ="06:30" sunset ="21:30" /> 回答1: Think you need convert this xml to DateTime and then use TimeZoneInfo class. If Denmark your local time: DateTime thisTime = DateTime.Now; bool isDaylight = TimeZoneInfo.Local.IsDaylightSavingTime(thisTime); Else you need to get Denmark TimeZone: DateTime thisTime = DateTime.Now; // get Denmark