dst

iOS safari getTime() DST behaviour

落爺英雄遲暮 提交于 2019-12-25 03:19:11
问题 i came across a strange behaviour of iOS 8.2 safari while converting datetime strings to unix ms timestamps during DST transition. Let's say we have js code function date2unix(dates){ var len = dates.length; var result = [], arr; while(len--) { arr = dates[len].split(/[- :]/); result[len]= (new Date(arr[0], arr[1]-1, arr[2], arr[3],arr[4],arr[5]).getTime()); } return result; } var dates = ["2015-03-29 00:00:00","2015-03-29 00:15:00","2015-03-29 00:30:00","2015-03-29 00:45:00","2015-03-29 01

How to get daylight saving settings programmatically in Xcode?

限于喜欢 提交于 2019-12-25 01:48:15
问题 Some countries are observing daylight saving, so I want to know if daylight setting is currently turned on or off (TRUE or FALSE) on the iDevice then I could correct the date on my app. is that possible? 回答1: Query the current NSCalendars timeZone to see if it is currently in daylight saving time. BOOL dst = [[[NSCalendar currentCalendar] timeZone] isDaylightSavingTime]; 来源: https://stackoverflow.com/questions/23152954/how-to-get-daylight-saving-settings-programmatically-in-xcode

Moment different behaviour on different browsers

本小妞迷上赌 提交于 2019-12-24 13:23:01
问题 Let the following snippet: var dateJS = new Date("1950-09-09T23:00:00.000Z"); var dateMoment = moment("1950-09-09T23:00:00.000Z"); console.log("Javascript Epoch Time:", dateJS.valueOf()); console.log("Moment Epoch Time:", dateMoment.valueOf()); console.log("Is DST?", dateMoment.isDST()); <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.23.0/moment.min.js"></script> If you run it with some Firefox versions (such as Firefox 61.0.1) or with Microsoft Edge you get Is DST? true .

Check for daylight saving time with WMI on Vista/Win7

ぐ巨炮叔叔 提交于 2019-12-24 08:47:14
问题 How do I find out if the computer I'm on has daylight saving time in effect? (preferably using WMI) According to this article at TechNet, I could query SELECT DaylightInEffect FROM Win32_ComputerSystem , but the property DaylightInEffect is not supported on Vista or Win7. As my program will run on various systems (XP, Vista, 7), I would appreciate some portable way of finding out. 回答1: The documented supported OS list is not accurate, this works fine on Win7 when I try it. I can't think of

Python: get timezone based on DST for a timestamp

三世轮回 提交于 2019-12-24 05:31:57
问题 I wrote such a code to get timezone based on DST for an specific epoch time: def getTimeZoneFromEpoch(epoch) if time.daylight and time.gmtime(epoch).tm_isdst==1: return -time.altzone/3600.0 else: return -time.timezone/3600.0 But i'm not sure its correct, in fact at the moment i mistakes by 1 hour. Maybe i should swap altzone and timezone in this code, but its not what i understood from python's help (time module): timezone -- difference in seconds between UTC and local standard time altzone -

Python: get timezone based on DST for a timestamp

岁酱吖の 提交于 2019-12-24 05:31:20
问题 I wrote such a code to get timezone based on DST for an specific epoch time: def getTimeZoneFromEpoch(epoch) if time.daylight and time.gmtime(epoch).tm_isdst==1: return -time.altzone/3600.0 else: return -time.timezone/3600.0 But i'm not sure its correct, in fact at the moment i mistakes by 1 hour. Maybe i should swap altzone and timezone in this code, but its not what i understood from python's help (time module): timezone -- difference in seconds between UTC and local standard time altzone -

Calendar TimeZone inDaylightTime returns incorrect answer for Israel

人走茶凉 提交于 2019-12-24 01:05:11
问题 Israel has recently changed its laws regarding DST such that when using the Calendar.getTimeZone().inDaylightTime(date) method, the response for the date range September 6th - October 27th is incorrect when deploying code to app engine. Interestingly when running on local dev server the range of dates that cause incorrect responses is different. Is there a short term workaround for this? What is the process for asking google to fix this? 回答1: The change you describe is captured in the IANA

php.ini disable daylight saving

柔情痞子 提交于 2019-12-23 21:16:37
问题 Our country stopped daylight saving. Now the time is 20:16 But on PHP the time is 21:16. Is there any way to disable daylight saving? My code is: echo date('Y-m-d H:i:s'); 回答1: The 2016 change for Azerbaijan is correctly reflected in the time zone database for the Asia/Baku time zone as of release 2016c. PHP gets its time zone information from the timezonedb PECL package. The 2016c tz data, inclusive of the Azerbaijan change, is in timezonedb version 2016.3. An embedded copy of this is

python time.time() and “Daylight Saving Time”

蓝咒 提交于 2019-12-23 12:49:25
问题 What happens when the clock of the computer running python (Windows or Linux) gets automatically changed and a call time.time() ? I've read that the value of time.time() will be smaller when the clock is changed manually to some value in the past. 回答1: time.time() docs state: Return the time in seconds since the epoch as a floating point number. The particular epoch referred to here is the Unix epoch, which is Midnight, Jan 1st 1970 UTC . Since it is always based on UTC, it will not be

How to check whether a given date is DST date or not?

廉价感情. 提交于 2019-12-23 10:40:55
问题 I have a date as string. There is no time info. For eg. "20131031" ie) 31 oktober 2013. I want to verify whether it is the date on which DST happens or not ? w.r.t. WesternEurope. ie) Does c# have an API, to say it is a DST date or not ? I want simply a boolean as return, for the last sunday of October and last sunday of March. which are the dates on which clocks are adjusted. 回答1: Yes, there is an API: TimeZone.GetDaylightChanges http://msdn.microsoft.com/en-us/library/system.timezone