dst

PHP Daylight savings conundrum

主宰稳场 提交于 2019-12-18 05:52: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

jodatime how to know if daylight savings is on

不羁岁月 提交于 2019-12-18 05:44:21
问题 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

Make Rails ignore daylight saving time when displaying a date

戏子无情 提交于 2019-12-18 03:44:10
问题 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

timezone with DST handling by PHP

寵の児 提交于 2019-12-17 23:38:39
问题 I am working on a calendar application. In this users from different time-zones create/view events. I am thinking to follow below method to save event time in UTC and display them in user's local time. Note: user has their preferred timezone setting. To save event start time as UTC timestamp: $timezone = new DateTimeZone( $user_timezone_name ); $utcOffset = $timezone->getOffset( new DateTime( $event_start_time_string_local ) ); $event_start_timestamp_local = maketime( $event_start_time_string

What is the System.TimeZoneInfo.IsDaylightSavingTime equivalent in NodaTime?

泄露秘密 提交于 2019-12-17 20:49:47
问题 System.TimeZoneInfo has a method called IsDaylightSavingTime, which takes a DateTime object and returns true if the specified datetime falls in the DST for that timezone. Is there an equivalent function in NodaTime or another way to achieve the same result? 回答1: You can get this from a ZoneInterval . Here is an extension method that will help. public static bool IsDaylightSavingsTime(this ZonedDateTime zonedDateTime) { var instant = zonedDateTime.ToInstant(); var zoneInterval = zonedDateTime

java.util.Date Calculate difference in days

佐手、 提交于 2019-12-17 16:39:25
问题 I tried to calculate the difference between two dates and I noticed one thing. When calculating only the days, the start of daylight saving time is included in the interval, so the result will be shorter with 1 day. To obtain accurate results, the value of hours also must be considered. For example: SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); Date dfrom = format.parse("03-29-2015"); Date dto = format.parse("03-30-2015"); long diff = dto.getTime() - dfrom.getTime(); System

PHP daylight saving time detection

不想你离开。 提交于 2019-12-17 06:39:34
问题 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

Does UTC observe daylight saving time?

痞子三分冷 提交于 2019-12-17 06:31:20
问题 I am trying to write a script where i want to convert any timezone to UTC and reverse. But from some where i came to know that while converting any timezone to UTC with or without DST consideration it will give the same UTC time. For example: If i try to convert this one: $mytime = '2011-03-31 05:06:00.000'; $myzone = 'America/New_York'; to UTC with DST and without DST,i will get .. (New_York->UTC DST=Yes)2011-03-31 09:06:00 (New_York->UTC DST=No)2011-03-31 09:06:00 .......... Is this corect

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

一个人想着一个人 提交于 2019-12-17 02:55:14
问题 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:

Daylight Saving Time change with an absolute date

Deadly 提交于 2019-12-14 03:15:27
问题 I'm trying to implement correct DST adjustment handling in my alarm clock app. So I'm reading description for DYNAMIC_TIME_ZONE_INFORMATION that I use to retrieve the current DST adjustment information via the GetTimeZoneInformationForYear API, and it says the following: DaylightDate : A SYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs on this operating system. If the time zone does not support daylight saving time