dst

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

邮差的信 提交于 2019-11-27 18:09:24
问题 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]

PHP date_default_timezone_set() Eastern Standard Time (EST)

為{幸葍}努か 提交于 2019-11-27 17:54:45
问题 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

How to add one day to a time obtained from time()

这一生的挚爱 提交于 2019-11-27 17:26:10
问题 I have a time represented as the number of seconds elapsed since midnight, January 1, 1970, UTC (the results of an earlier call to time()). How do I add one day to this time? Adding 24 * 60 * 60 works in most cases, but fails if the daylight saving time comes on or off in between. In other words, I mostly want to add 24 hours, but sometimes 23 or 25 hours. To illustrate - the program: #include <time.h> #include <iostream> int main() { time_t base = 1142085600; for(int i = 0; i < 4; ++i) {

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

我怕爱的太早我们不能终老 提交于 2019-11-27 17:21:15
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 datetime (its not literally a number but some kind of an identifier like ORDR-13432-Year-Month-Day ).

Get Timezone Information in VBA (Excel)

℡╲_俬逩灬. 提交于 2019-11-27 14:40:59
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.getTimeZone("Europe/Bucharest"); bucharestTimeZone.getOffset(new Date().getTime()); Calendar nowInBucharest

Does ConvertTimeFromUtc() and ToUniversalTime() handle DST?

元气小坏坏 提交于 2019-11-27 14:00:34
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(localTime)) localTime = localTime.AddHours(1); // is this needed !? return localTime; } The question is

Convert UTC DateTime to another Time Zone

▼魔方 西西 提交于 2019-11-27 13:06:12
I have a UTC DateTime value coming from a database record. I also have a user-specified time zone (an instance of TimeZoneInfo). How do I convert that UTC DateTime to the user's local time zone? Also, how do I determine if the user-specified time zone is currently observing DST? I'm using .NET 3.5. Thanks, Mark Have a look at the DateTimeOffset structure: // user-specified time zone TimeZoneInfo southPole = TimeZoneInfo.FindSystemTimeZoneById("Antarctica/South Pole Standard Time"); // an UTC DateTime DateTime utcTime = new DateTime(2007, 07, 12, 06, 32, 00, DateTimeKind.Utc); // DateTime with

Determine Whether Daylight Savings Time (DST) is Active in Java for a Specified Date

偶尔善良 提交于 2019-11-27 12:17:06
I have a Java class that takes in the latitude/longitude of a location and returns the GMT offset when daylight savings time is on and off. I am looking for an easy way to determine in Java if the current date is in daylight savings time so I can apply the correct offset. Currently I am only performing this calculation for U.S. timezones although eventually I would like to expand this to global timezones as well. Clint This is the answer for the machine on which the question is being asked: TimeZone.getDefault().inDaylightTime( new Date() ); A server trying to figure this out for a client will

Get Daylight Saving Transition Dates For Time Zones in Java

折月煮酒 提交于 2019-11-27 12:10:01
I'd like to know the simplest way, in Java, to get a list of dates in the future where daylight savings time will change. One rather inellegant way to do this would be to simply iterate over a bunch of years' worth of days, testing them against TimeZone.inDaylightTime(). This will work, and I'm not worried about efficiency since this will only need to run every time my app starts, but I wonder if there's a simpler way. If you're wondering why I'm doing this, it's because I have a javascript app which needs to handle third-party data containing UTC timestamps. I want a reliable way to translate

Getting ZoneId from a SimpleTimeZone

一个人想着一个人 提交于 2019-11-27 08:49:49
问题 Using Java I have a SimpleTimeZone instance with GMT offset and daylight saving time information from a legacy system. I would like to retrieve ZoneId to be able to use Java 8 time API. Actually, toZoneId returns a ZoneId without the daylight Saving time infos SimpleTimeZone stz = new SimpleTimeZone( 2 * 60 * 60 * 1000, "GMT", Calendar.JANUARY,1,1,1, Calendar.FEBRUARY,1,1,1, 1 * 60 * 60 * 1000); stz.toZoneId(); 回答1: First of all, when you do: SimpleTimeZone stz = new SimpleTimeZone(2 * 60 *