timezone

Getting incorrect time leading by 1 hour with Europe/Moscow timezone

╄→尐↘猪︶ㄣ 提交于 2019-12-23 07:45:53
问题 For our Russia tenant we are using "Europe/Moscow" timezone. But we are getting time with 1 hour ahead of the correct time. Europe/Moscow is UTC+3 hours. But when I am print date formated with Europe/Moscow timezone getting 1 hour ahead of the correct time. Thanks, Syamala. 回答1: I notice that there was a legislative change to Russian time zone definitions in October 2014; chances are that your JRE simply doesn't know about it yet. The Java Timezone Updater Utility should be able to fix this

DateTime parsing error: The supplied DateTime represents an invalid time

纵然是瞬间 提交于 2019-12-23 07:40:08
问题 I have one situation where date is "3/13/2016 2:41:00 AM" . When I convert date by time-zone, I get an error. DateTime dt = DateTime.Parse("3/13/2016 2:41:00 AM"); DateTime Date_Time = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, "Eastern Standard Time", "GMT Standard Time"); Response.Write(dt); after execution, I get this error: The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid. Parameter

How do I programmatically set the time zone in Java?

假装没事ソ 提交于 2019-12-23 07:36:46
问题 I know I can feed VM arguments as follows -Duser.timezone="Australia/Sydney" Is there a programmatic way to do the equivalent? I would like the setting to be applied across the entire virtual machine. 回答1: java.util.TimeZone.setDefault() can be used to set a default time zone to be returned by getDefault() . 来源: https://stackoverflow.com/questions/7630753/how-do-i-programmatically-set-the-time-zone-in-java

Why was Date.getTimezoneOffset deprecated?

时光怂恿深爱的人放手 提交于 2019-12-23 07:35:24
问题 The documentation for Date.getTimezoneOffset says: Deprecated. As of JDK version 1.1, replaced by -(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000). Why was it deprecated? Is there a shorter way (Apache Commons?) to get the offset from UTC in hours/minutes? I have a Date object ... should I convert it to JodaDate for this? And before you ask why I want the UTC offset - it's just to log it, nothing more. 回答1: There are 2 questions here. Why was Date

Change TimeZone dynamically in laravel

荒凉一梦 提交于 2019-12-23 07:31:29
问题 In my project there is drop-down of time zones(PT,CST etc), when Admin changes the timezone from drop-down the admin panel reflects the timezone from the selected drop down. How to change Config/app.php "timezone"( Application Timezone) according to the selected option. 回答1: You can use Laravel helper function config to set timezone. However, this will affects only the request you will receive. config(['app.timezone' => $timezone]); If your goal is to change once the timezone and run on every

How do I convert from unix epoch time and account for daylight saving time in C#?

只谈情不闲聊 提交于 2019-12-23 07:13:09
问题 I have a function that converts from unix epoch time to a .NET DateTime value: public static DateTime FromUnixEpochTime(double unixTime ) { DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return d.AddSeconds(unixTime); } Where I am (UK) the clocks go one hour forward for summer time. In Python I get the local Epoch time using time.time() (and for the sake of argument, right now the time is 17:15:00) which gives me a value of 1286122500 . If I convert this back to a human

How do I convert from unix epoch time and account for daylight saving time in C#?

穿精又带淫゛_ 提交于 2019-12-23 07:10:08
问题 I have a function that converts from unix epoch time to a .NET DateTime value: public static DateTime FromUnixEpochTime(double unixTime ) { DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return d.AddSeconds(unixTime); } Where I am (UK) the clocks go one hour forward for summer time. In Python I get the local Epoch time using time.time() (and for the sake of argument, right now the time is 17:15:00) which gives me a value of 1286122500 . If I convert this back to a human

Using DateFormat.getDateTimeInstance().format(date);

狂风中的少年 提交于 2019-12-23 07:04:19
问题 When running some tests I came across the following issue. When using: private String printStandardDate(Date date) { return DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT).format(date); } I found this produced different formats of Date depending on the location the tests where run from. So locally in windows / eclipse I got a result: 04/02/12 18:18 but on the Linux box in America I get 2/4/12 6:18 PM This causes my Tests/Build to fail: expected:<[04/02/12 18:18]> but was:<

timezone aware date_trunc function

橙三吉。 提交于 2019-12-23 06:55:23
问题 The following query SELECT the_date FROM date_trunc('day', timestamp with time zone '2001-01-1 00:00:00+0100') as the_date results to the_date 2000-12-31 00:00 Is there a way to tell date_trunc to do day/month/year conversions based on the timezone it is feeded with? The expected output would be: 2001-01-1 00:00+0100 回答1: You need to specify at which time zone you want it to show select date_trunc( 'day', timestamp with time zone '2001-01-1 00:00:00+0100' at time zone '-02' ) as the_date; the

timezone aware date_trunc function

早过忘川 提交于 2019-12-23 06:54:27
问题 The following query SELECT the_date FROM date_trunc('day', timestamp with time zone '2001-01-1 00:00:00+0100') as the_date results to the_date 2000-12-31 00:00 Is there a way to tell date_trunc to do day/month/year conversions based on the timezone it is feeded with? The expected output would be: 2001-01-1 00:00+0100 回答1: You need to specify at which time zone you want it to show select date_trunc( 'day', timestamp with time zone '2001-01-1 00:00:00+0100' at time zone '-02' ) as the_date; the