timezone-offset

Why isn't the offset of Samoa +13 or +14 when using pytz?

回眸只為那壹抹淺笑 提交于 2019-12-11 08:58:32
问题 I've just read BBC: Samoa and Tokelau skip a day for dateline change, 30.12.2011 I wanted to see this with pytz , but everything I tried only showed an offset of -11, but not of +13 or +14: >>> import pytz >>> tz = pytz.timezone('Pacific/Samoa') >>> tz_us = pytz.timezone('US/Samoa') >>> import datetime >>> datetime.datetime(2011, 12, 30, 9, 00, tzinfo=datetime.timezone.utc).astimezone(tz).isoformat() '2011-12-29T22:00:00-11:00' >>> datetime.datetime(2011, 12, 30, 10,00, tzinfo=datetime

In SSMS, display DateTimeOffset value in local timezone

纵饮孤独 提交于 2019-12-11 06:34:22
问题 Isn't there a way to configure Sql Server Management Studio to, in query results, display the value of a DateTimeOffset column in the client's local timezone, instead of UTC? Example: I'm in timezone +02:00. A value is stored as 2016-07-27 22:00:00.0000000 +00:00 . Currently, this value is displayed as such in query results. I want it to be displayed (formatted) as 2016-07-28 00:00:00.0000000 +02:00 when executing this query on SSMS on my machine. Currently I'm manually using something like

Convert time to different timezone with jQuery

此生再无相见时 提交于 2019-12-11 02:27:08
问题 I have a time and date in the "Zulu" time zone (which is the same time zone as Coordinated Universal Time (UTC)) I need to convert this time and date into the Central time zone using jQuery. Right now Im attempting to use "Moment Timezone" since I already use "Moment" and it seems like Timezone is capable of what I need but the documentation is sparse. I thought this would work but it returns "Monday, January 20 2014 1:03 AM" without converting the time var stampString='January 20 2014 01:03'

How to add/subtract TimeZone Offset to a Timestamp in Java?

对着背影说爱祢 提交于 2019-12-10 18:53:33
问题 I am using JDK 8 and I played with ZonedDateTime and Timestamp a lot. But still I am not able to get a solution for the problem I am facing. Lets say I get a formatted Timestamp in GMT (UTC) and my server is located somewhere. Lets say it's set to Asia/Calcutta TimeZone (whose ZoneOffset is +05:30 ). How to basically add/subtract my time zone offset to the Timestamp? Input : 2017-09-13 13:10:30.333 Output: 2017-09-13 18:40:30.333 Explanation : In the input, the timezone offset which is 5hrs

How to make ZoneOffset UTC return “+00:00” instead of “Z”

泪湿孤枕 提交于 2019-12-10 14:57:13
问题 Is there any built-in method in java to return "+00:00" for ZoneOffset UTC? The getId() method only return "Z" . My current approach is manual change it to "+00:00" if the result is "Z" public static String getSystemTimeOffset() { String id = ZoneOffset.systemDefault().getRules().getOffset(Instant.now()).getId(); return "Z".equals(id) ? "+00:00" : id; } 回答1: private static DateTimeFormatter offsetFormatter = DateTimeFormatter.ofPattern("xxx"); public static String getSystemTimeOffset() {

Java convert millisecond timestamp to date with respect to given timezone

给你一囗甜甜゛ 提交于 2019-12-10 11:28:51
问题 I have seen many resources on this but one thing I cant get is when converting the millisecond timestamp, how I add a corresponding time zone, during the conversion process. Date date = new Date(Long.valueOf(dateInMil*1000L); SimpleDateFormat myDate = new SimpleDateFormat("EEE, MMM d, ''yy"); String formatted = myDate.format(date); Now if I have a time zone/offset in string formate i.e. "-04:00" or "+2:00" how to apply it to the above so I can get the proper date ? 回答1: I was doing a similar

Javascript display various time zones

二次信任 提交于 2019-12-10 10:58:03
问题 The following script should be displaying the current local time based on the offset of -10 (Hawaii), but it's not working. Can't figure out where I'm going wrong. <h3>Current Time in Arizona is <script type="text/javascript"> <!-- var currentTime = new Date() var hours = currentTime.getHours() var minutes = currentTime.getMinutes() if (minutes < 10) minutes = "0" + minutes var suffix = "AM"; if (hours >= 12) { suffix = "PM"; hours = hours - 12; } if (hours == 0) { hours = 12; } document

mysql NOW() return wrong value whereas global timezone is set +00:00

你说的曾经没有我的故事 提交于 2019-12-10 05:02:43
问题 since 2 weeks I puzzled over timezone issue, everything working fine on my localhost BUT it returns wrong value on dedicated server. Let me tell what i have done so far. First set global timezone by below query: ( Super privilege both on localhost and server ) SET GLOBAL time_zone = '+00:00'; now run below query to cross check whatever done SELECT NOW(),@@global.time_zone AS gtz,@@session.time_zone AS stz, TIMEDIFF(NOW(), CONVERT_TZ( NOW() , @@session.time_zone , '+00:00' ) ) AS OFFSET; but

Get current timestamp from specific timezone

烈酒焚心 提交于 2019-12-09 17:41:32
问题 is there an easy way to get the unix timestamp in javascript from a specific timezone? for example i want the client send me an unix timestamp but i want to get it to match my timezone. thanks! 回答1: Why not simply send the date in UTC, and then convert to your timezone on the server? var utcEpochSeconds = dateObj.getTime() + (dateObj.getTimezoneOffset() * 60000); 回答2: Use toISOString to get a UTC timestamp. var date = new Date(); date.toISOString(); // EST would be 6 hour diff from GMT 回答3:

Angular JS - Date changes when submitting to $http - Timezone issue

笑着哭i 提交于 2019-12-09 05:10:29
问题 I am having a strange problem where a Date changes when it is passed to API through $http.put, I suspect a timezone issue: Datepicker triggers ng-change event - console.log: Tue Jun 10 2014 00:00:00 GMT+0100 (GMT Summer Time) Passed to API using Angular $http.put... When it hits Fiddler: StartDate=2014-06-09T23:00:00.000Z As you can see the date changes from 10th June to 9th June. How can I stop this change of date? Is it the timezone causing the change? Both the API and client side are