timezone-offset

Is timezone just an offset number or “more information”?

旧时模样 提交于 2019-12-20 02:34:06
问题 I live in a country where they change the time twice a year. That is: there is a period in the year when the offset from UTC is -3 hours (-180 mins) and other period where the offset is -4 hours (-240 mins) Grafically: |------- (offset = -3) -------|------- (offset is -4) -------| start of year mid end of year My question is: the "timezone" is just the number representing the offset? that is: my country has two timezones? or the timezone includes this information? This is important because I

How to get timezone from timezone offset in java?

倖福魔咒の 提交于 2019-12-18 09:04:11
问题 I know how to get the opposite. That is given a timezone I can get the timezone offset by the following code snippet: TimeZone tz = TimeZone.getDefault(); System.out.println(tz.getOffset(System.currentTimeMillis())); I want to know how to get the timezone name from timezone offset. Given, timezone offset = 21600000 (in milliseconds; +6.00 offset) I want to get result any of the following possible timezone names: (GMT+6:00) Antarctica/Vostok (GMT+6:00) Asia/Almaty (GMT+6:00) Asia/Bishkek (GMT

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

How to convert time correctly across timezones?

冷暖自知 提交于 2019-12-17 10:34:42
问题 Let's say user in CA, US picks up a date, time and timezone: Worldwide beer marathon starts on 8/15/2013 10:00 am, UTC-08:00 Another user, in Central Europe opens the page where this date and time is displayed. He doesn't want to do time calculations (had few beers already). He just wants to see this date and time: 8/15/2013 19:00 Given the browser receives the date and time information, as entered by user in California: Is there a way, in javascript , without external web services , to do a

Convert UTC to “local” time in Go

半世苍凉 提交于 2019-12-17 09:47:08
问题 How can I convert UTC time to local time ? I've created a map with the UTC difference for all the countries I need the local time. Then I add that difference as duration to the current time (UTC) and print the result hoping that's the local time of that specific country. For some reasons the result is wrong. For example with Hungary there is one hour difference. Any idea why I'm getting incorrect results? package main import "fmt" import "time" func main() { m := make(map[string]string) m[

Calculating timezone from GMT value - Android

一个人想着一个人 提交于 2019-12-14 03:27:28
问题 In a android form , i am accepting a GMT value(offset) from user such a +5:30 , +3:00. and from this value , i want to calculate the timeZone that is "India/Delhi". Any ideas on how to do it ......Plzz 回答1: If you already have a specific instant in time at which that offset is valid, you could do something like this: import java.util.*; public class Test { public static void main(String [] args) throws Exception { // Five and a half hours int offsetMilliseconds = (5 * 60 + 30) * 60 * 1000;

Is there an easy way to get the current time difference between the current timezone and UTC in Python?

旧时模样 提交于 2019-12-13 05:05:50
问题 My purpose is simply to output a time zone string like -0700 used in e-mail. Specifically, I want it to reflect the exact time zone, daylight saving included. This means I will get -0700 in California in summer, -0800 in California in winter, and always +0800 in China (no daylight saving). I find it difficult for two reasons: The Python integer division, unlike in C99 and normal C/C++ implementations, always rounded towards the floor instead of zero. (This matters for calculations involving a

Get current week start/end date with DST

坚强是说给别人听的谎言 提交于 2019-12-13 04:41:43
问题 I was using the following code for some months now without any issue in order to get the current week start/end date (Monday/Sunday): date_default_timezone_set('Europe/Bucharest'); //this is the default in php.ini $monday = strtotime('next Monday -1 week'); $monday = date('w', $monday)==date('w') ? $monday+7*86400 : $monday; $sunday = strtotime(date("Y-m-d",$monday)." +6 days"); echo "Current week start/end date:<br>"; echo $this_week_sd = date("Y-m-d",$monday)."<br>"; echo $this_week_ed =

Converting Between Timezones in Postgres

爷,独闯天下 提交于 2019-12-12 16:33:18
问题 I am trying to understand the timestamps and timezones in Postgre. I think I got it, until I red this article. Focus on the "Converting Between Timezones" part. It has two examples. (Consider the default timezone configuration to be UTC.) Example 1 db=# SELECT timezone('US/Pacific', '2016-01-01 00:00'); outputs 2015-12-31 16:00:00 According to the article and what I understand, because the '2016-01-01 00:00' part of the timezone function is just a string, it is silently converted to the

Why does momentjs isDST() return wrong time when zone() is used

和自甴很熟 提交于 2019-12-12 12:13:28
问题 I'm trying to check for isDST() (returns true or false if daylight saving time is active). It works fine if I use the current date time- for example var isdst = moment().isDST() returns true for my timezone. However, what I want to do is first set the timezone offset and then check to see if daylight saving time is active in that timezone. I have the following code below. var isdst = moment('2014-03-28').zone('+01:00'); console.log('daylight savings for +0100 is ' + isdst); //returns true