timezone

Oracle date compare broken because of DST

半城伤御伤魂 提交于 2019-12-28 06:41:31
问题 We've been debugging an issue with a SQL query executed from an app server running Java via Hibernate. The error: [3/10/14 10:52:07:143 EDT] 0000a984 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: 1878, SQLState: 22008 [3/10/14 10:52:07:144 EDT] 0000a984 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions ORA-01878: specified field not found in datetime or interval We've been able to narrow this down to the simple SQL below. select * from

How can I determine a timezone by the UTC offset?

大憨熊 提交于 2019-12-28 05:52:05
问题 I have a scenario where I have a timezone offset (in minutes) and need to determine the timezone for it. I know that all the data is not available (for example, there may be several timezones with an offset of -240 minutes) but a "best guess" is acceptable. My first pass looked like this: foreach (var info in TimeZoneInfo.GetSystemTimeZones()) { if (info.BaseUtcOffset.TotalMinutes == timezoneOffset) { // do something here if this is a valid timezone } } This sorta works, but I need to account

Setting timezone for maven unit tests on Java 8

[亡魂溺海] 提交于 2019-12-28 05:32:05
问题 How do I set the timezone for unit tests in maven surefire on Java 8? With Java 7 this used to work with systemPropertyVariables like in the following configuration, but with Java 8 the tests just use the system timezone. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <user.timezone>UTC</user.timezone> </systemPropertyVariables> Why is that, and how do I fix it? 回答1: Short answer Java now reads user

Error updating tzdata 2018f (Released 2018-10-18) with tzupdater-2.2.0

送分小仙女□ 提交于 2019-12-28 04:01:13
问题 I'm trying to update JVM's Time Zone info using TZUpdater 2.2.0. > [root@local tzupdater-2.2.0]# java -jar tzupdater.jar -V tzupdater version 2.2.0-b01 JRE tzdata version: tzdata2018d tzupdater tool would update with tzdata version: tzdata2018f So, I'm running the command below: > [root@local tzupdater-2.2.0]# java -jar tzupdater.jar -l However, I'm getting this error message: Failed: java.lang.Exception: Failed while parsing file '/tmp/tz.tmp_1/asia' on line 1655 'Rule Japan 1948 1951 - Sep

linux convert time(for different timezones) to UTC

偶尔善良 提交于 2019-12-28 03:10:10
问题 Is there a way, in linux, to programmatically get UTC time for a given time string like Tue Dec 14 10:30:23 PST 2012 Tue Jan 4 11:30:23 EST 2013 to a UTC time, irrespective of( and without changing) local time zone settings? 回答1: date -u -d "Tue Dec 14 10:30:23 PST 2012" reports Fri Dec 14 18:30:23 UTC 2012 . The discrepancy is because Dec 14 2012 is in fact a Friday, not a Tuesday. It probably works better with valid input... 回答2: Update : the result with the recent tz database is different:

How to convert datetime to timestamp using C#/.NET (ignoring current timezone)

♀尐吖头ヾ 提交于 2019-12-28 02:51:06
问题 How do I convert datetime to timestamp using C# .NET (ignoring the current timezone)? I am using the below code: private long ConvertToTimestamp(DateTime value) { long epoch = (value.ToUniversalTime().Ticks - 621355968000000000) / 10000000; return epoch; } But it returns the timestamp value according to the current time zone & and I need the result without using the current timezone. 回答1: At the moment you're calling ToUniversalTime() - just get rid of that: private long ConvertToTimestamp

Java 8 timezone conversions

若如初见. 提交于 2019-12-28 02:10:10
问题 In Java 8, I want to convert a datetime from UTC to ACST (UTC+9:30). input -> 2014-09-14T17:00:00+00:00 output-> 2014-09-15 02:30:00 String isoDateTime = "2014-09-14T17:00:00+00:00"; LocalDateTime fromIsoDate = LocalDateTime.parse(isoDateTime, DateTimeFormatter.ISO_OFFSET_DATE_TIME); ZoneOffset offset = ZoneOffset.of("+09:30"); OffsetDateTime acst = OffsetDateTime.of(fromIsoDate, offset); System.out.println(acst.toString()); // 2014-09-14T17:00+09:30 System.out.println(acst.format

PHP, MySQL and Time Zones

扶醉桌前 提交于 2019-12-28 01:50:27
问题 I am trying to integrate a timezone system in my app, i've really tried hard on avoiding making timezone-aware apps upto now - but its a mandatory requirement now so got no choice. TimeZones it just goes over my head. I've read several topics on PHP.net and also other sites including but not limited to SO. But i never could get the hang of it. So i was wondering if some one can help me out here :( What i'm looking to make is a preference option in my app to allow users to choose their own

python - datetime with timezone to epoch

最后都变了- 提交于 2019-12-27 12:04:40
问题 In the code below, I am calculating now epoch and beginning of current day epoch. import time import pytz from datetime import datetime tz1 = pytz.timezone('CST6CDT') utc = pytz.timezone('UTC') now = pytz.UTC.localize(datetime.utcnow()) now_tz = now.astimezone(tz1) print now_tz print now_tz.strftime('%s') begin_day = now_tz.replace(hour=0, minute=0, second=0) print begin_day print begin_day.strftime('%s') print statements: 2012-08-28 13:52:21.595718-05:00 1346187141 2012-08-28 00:00:00.595718

How to use a custom time in browser to test for client vs server time difference

余生颓废 提交于 2019-12-27 11:40:09
问题 I just wrote a little piece of code to show the server time in a webpage. At the moment I just have one machine so I cannot test if the code is working. Is there a way to tell the browser to use a time configuration different from the one configured in the OS? I have used plugins for Firefox to test different locales, I wonder if there are similar options for time tests. Thanks. 回答1: Unfortunately, JavaScript is only aware of the current time zone, as it is set by the operating system. There