timezone

how to know the timezone name from utc time offset in javascript

你离开我真会死。 提交于 2020-12-15 07:08:23
问题 How to know the timezone name from UTC offset in Javascript. I have UTC offset, say UTC+5:30, I need to know where this timezone location is, like I want to get 'Asia/Calcutta'. If I give ' UTC+9 ' , then I need to get Asia/Tokyo How to do this in Javascript? 回答1: You should be able to get that using Intl API. You can find the demo at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/resolvedOptions 回答2: You can try that: console.log(Intl

Where does Node.js get the Timezone data from?

狂风中的少年 提交于 2020-12-15 06:18:08
问题 Is the IANA timezone data in nodejs embedded in the Node.js code or does it take the data from the OS? It seems that it has its own version as process.versions returns the time zone version as stated here. If so do I need to install a new Node.js version to update the timezone data or is there another way? 回答1: Node.js gets its timezone data from the ICU library, aka International Components for Unicode , which also provides API artefacts to obtain timezone data. Generally, neither Node.js

Spring data query for localdate returns wrong entries - minus one day

余生长醉 提交于 2020-12-13 04:52:09
问题 In my Entity i have a field of type LocalDate "day" in MySQL it is mapped to "date" type. MySQL seems to run on UTC SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP); is returning 00:00:00 . My system is running CET (UTC+1) If i query it via sql (console from IntelliJ configured with empty Time zone ) the query select * from table where day = '2020-10-18'; Returns entries with correct date. The query specified with Spring data findByDay is also looking correct: 2020-11-09 16:16:32.911 DEBUG 5600 --- [

I want to validate timezone at the backend which is coming from the frontend in golang

情到浓时终转凉″ 提交于 2020-12-13 04:08:50
问题 The front-end is sending timezones along with other user details during sign up. I need to put a validator on timezone for api testing. The data in the timezone is of the format: (GMT-10:00) Hawaii (GMT-08:00) Pacific Time (US & Canada) What I did is define all the timezones in an array and then search for the received timezone. If it exists then ok else return err. My function is: func timeZoneValidator(field validator.FieldLevel) bool { if field.Field().Kind() != reflect.String { return

datetime: get timestamp with timezone offset

戏子无情 提交于 2020-12-13 03:12:57
问题 I would like to get the timestamp from dates in the following formats: Mon, 23 Nov 2020 19:00:00 GMT Mon, 23 Nov 2020 20:00:00 +0100 I am using the the following statements to convert dates to datetime objects: dateobj = datetime.datetime.strptime(date, '%a, %d %b %Y %H:%M:%S %Z') dateobj = datetime.datetime.strptime(date, '%a, %d %b %Y %H:%M:%S %z') But using .timestamp() method, different seconds from epoch are printed. Why doesn't the %Z directive add timezone information to the datetime

merge.zoo removes time zone

廉价感情. 提交于 2020-12-12 10:52:09
问题 The result of merge.zoo does not have the same time zone as its input. Consider the following example library(zoo) zoo_a=zoo(data.frame(a=1:5), seq(as.POSIXct("2014-01-01 00:00:01",tz="UTC"), as.POSIXct("2014-01-01 00:00:05",tz="UTC"), by=1) ) zoo_b=zoo(data.frame(a=1:4), seq(as.POSIXct("2014-01-01 00:00:01",tz="UTC"), as.POSIXct("2014-01-01 00:00:05",tz="UTC"), by=1) ) zoo_merged=merge(zoo_a,zoo_b) time(zoo_merged)[1] #2013-12-31 19:00:01 EST time(zoo_a)[1] #2014-01-01 00:00:01 UTC time(zoo

VBA local timezone adjustment

≯℡__Kan透↙ 提交于 2020-12-11 04:51:29
问题 Say I have a local Pacific Time (UTC-8) Excel value. For example 41656.67297 is 17 January 2014 4:09 PM . I do not have control of this value. I want to adjust the given value relative to the users local time. Say for example someone in Dublin is using the Excel workbook. I want to adjust the given number and display it in his local time, 18 January 2014 12:09 AM . Is there any built in Excel functionality to make this smooth? 回答1: VBA doesn't provide an option for this natively, but there's

Calendar.getTime() fails with java.lang.IllegalArgumentException:MINUTE for Asia/Singapore timezone

天涯浪子 提交于 2020-12-11 01:04:19
问题 Why is this code failing? The purpose was to remove the time part. String dateStr = "1982-01-01"; String timeZoneID = "Asia/Singapore"; DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone(timeZoneID)); calendar.setLenient(false); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0);

Calendar.getTime() fails with java.lang.IllegalArgumentException:MINUTE for Asia/Singapore timezone

眉间皱痕 提交于 2020-12-11 01:00:28
问题 Why is this code failing? The purpose was to remove the time part. String dateStr = "1982-01-01"; String timeZoneID = "Asia/Singapore"; DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone(timeZoneID)); calendar.setLenient(false); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0);

Calendar.getTime() fails with java.lang.IllegalArgumentException:MINUTE for Asia/Singapore timezone

冷暖自知 提交于 2020-12-11 01:00:16
问题 Why is this code failing? The purpose was to remove the time part. String dateStr = "1982-01-01"; String timeZoneID = "Asia/Singapore"; DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone(timeZoneID)); calendar.setLenient(false); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0);