dst

Working with timezones and daylight savings time in Javascript

余生长醉 提交于 2019-11-27 01:48:55
问题 My single-page javascript app retrieves data in JSON format via REST calls. Dates come formatted using the UTC timezone in standard ISO8601 format, such as 2011-02-04T19:31:09Z . When signing up for the service, users select their timezone from a drop down list. This timezone could be different than the user's browser's timezone. The javascript app knows what the user's selected timezone is at all times. I know how to convert the UTC string into a date. I understand that Javascript only

PHP daylight saving time detection

∥☆過路亽.° 提交于 2019-11-27 01:19:46
I need to send an email to users based wherever in the world at 9:00 am local time. The server is in the UK. What I can do is set up a time difference between each user and the server's time, which would then perfectly work if DST didn't exist. Here's an example to illustrate it: John works in New York, -5 hours from the server (UK) time Richard works in London, UK, so 0 hour difference with the server. When the server goes from GMT to GMT +1 (BST) at 2:00am on a certain Sunday, this means that John now has a -6H time difference now. This scenario I can still handle by updating all the users

Accounting for DST in Postgres, when selecting scheduled items

喜你入骨 提交于 2019-11-27 00:47:59
问题 I have a Postgres table of clock alarms (not really, but this is analogous, and easier to explain). Alarms are set by users with a 1 hour resolution, and users can be from many different timezones. The alarms are repeating daily. I want to reliably fetch the alarms that are supposed to go off at a particular hour of the day, and I am having problems with daylight saving time . How do I do this in the best way? Example Alfred and Lotta both live in Stockholm (+1 hour from UTC, but +2h when it

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

时光毁灭记忆、已成空白 提交于 2019-11-27 00:37:45
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 if there is a workaround for this problem apart from restarting the application? Hans Passant Yes, the

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

℡╲_俬逩灬. 提交于 2019-11-26 23:58:10
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. GetEndTimeByEvent) it always sends the end time in UTC format. Approach 1: If it is decided to store in

Python daylight savings time

二次信任 提交于 2019-11-26 22:38:08
How do I check if daylight saving time is in effect? You can use time.localtime and look at the tm_isdst flag in the return value. >>> import time >>> time.localtime() (2010, 5, 21, 21, 48, 51, 4, 141, 0) >>> _.tm_isdst 0 Using time.localtime() , you can ask the same question for any arbitrary time to see whether DST would be (or was) in effect for your current time zone. The accepted answer is fine if you are running code on your laptop, but most python applications are running on a server using UTC as local time, so they will NEVER be in daylight savings time according to the accepted answer

Does ConvertTimeFromUtc() and ToUniversalTime() handle DST?

余生长醉 提交于 2019-11-26 22:23:39
问题 If daylight saving time is in effect, and a date object has been saved into the database (UTC format) which you retrieve to show it in the view (for example the view in asp.net-mvc ). And you do that by using this method: public static DateTime ConvertToLocalTimeFromUtcTime(DateTime utcDate, string timeZoneId) { TimeZoneInfo localZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(utcDate, localZone); if (localZone.IsDaylightSavingTime

How to create Daylight Savings time Start and End function in SQL Server

雨燕双飞 提交于 2019-11-26 20:38:34
问题 I need to create a function in SQL server that returns daylight savings time start datetime and daylight savings time end datetime. I've come across a few examples on the web, however they all are using the 1st date of March and the 1st date of November and thats not technically correct. Daylight savings time begins at 2AM on the 2nd Sunday of March and ends on at 2AM in the first Sunday in November. I've started with the below code but I'm sure its wrong. Any assistance is appreciated! :)

Best practices with saving datetime & timezone info in database when data is dependant on datetime

自古美人都是妖i 提交于 2019-11-26 18:53:05
问题 There were quite a few questions about saving datetime & timezones info in DB but more on the overall level. Here I'd like to address a specific case. System specs We have an Orders system database It is a multi-tenant system where tenants can use arbitrary timezone (it is arbitrary but single timezone per tenant, saved in Tenants table once and never changes) Business rule needed to be covered in DB When tenant places an Order into the system, order number gets computed based on their local

Get Timezone Information in VBA (Excel)

ε祈祈猫儿з 提交于 2019-11-26 18:24:19
问题 I would like to determine a time offset to GMT/UTC (including daylight saving time) for different countries at a specific date in VBA. Any ideas? EDIT (from self-answer): Thank you 0xA3. I quickly read-over the linked page. I assume that you can only get the offset to GMT for the local where windows is running: ConvertLocalToGMT DaylightTime GetLocalTimeFromGMT LocalOffsetFromGMT SystemTimeToVBTime LocalOffsetFromGMT In Java you can do the following: TimeZone bucharestTimeZone = TimeZone