timezone

Django: Running a process each day at specified user local time

感情迁移 提交于 2021-02-19 09:23:17
问题 I'm porting my site to python/django, and one of the main exercises involves a set of data where users can schedule an event in their local time, and have it happen every day. Currently i have a cron job (on another server) that hits up a method every e.g 5 minutes and see's if anything needs to be schedule over the next (let's say ) 10 minutes. I store a Time value, and the user's local timezone for each job What is the best way to do this? Right now I am working on a function that: Converts

TimeZoneInfo.ConvertTimeFromUtc returned wrong DateTime

a 夏天 提交于 2021-02-19 07:47:06
问题 I called method: TimeZoneInfo.ConvertTimeFromUtc(DateTime.Now.ToUniversalTime(), TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")) // UTC+0 It is returned DateTime for one hour larger than the correct DateTime. Why? How will it fix? Returned value should be equal DateTime.Now.ToUniversalTime() 回答1: UTC is equal to GMT. But currently we're in BST due to summer, which is GMT + 1. GMT Standard Time automatically adjusts for daylight savings. Use Greenwich Standard Time , rather than GMT

Is there a ZonedDateTime (Java) in .Net?

社会主义新天地 提交于 2021-02-19 05:19:50
问题 The best equivalent I've found is the combination of a DateTimeOffset + TimeZoneInfo. Is that the best approach, create a structure that contains both of these classes and insure they stay consistent? 回答1: No, there is not a built-in type similar to ZonedDateTime in the .NET base class library. As others pointed out, if you're looking for a temporal model similar to Java's Joda Time or java.time , then consider using Noda Time. It has a ZonedDateTime structure. If you don't want to use Noda

Is there a ZonedDateTime (Java) in .Net?

走远了吗. 提交于 2021-02-19 05:19:25
问题 The best equivalent I've found is the combination of a DateTimeOffset + TimeZoneInfo. Is that the best approach, create a structure that contains both of these classes and insure they stay consistent? 回答1: No, there is not a built-in type similar to ZonedDateTime in the .NET base class library. As others pointed out, if you're looking for a temporal model similar to Java's Joda Time or java.time , then consider using Noda Time. It has a ZonedDateTime structure. If you don't want to use Noda

Python 3.9: Construct DST valid timestamp using standard library

☆樱花仙子☆ 提交于 2021-02-19 04:35:07
问题 I would like to contruct DST-valid timestamps only using the standard library in Python 3.9 and was hoping this was possible with this version. In my timezone "Europe/Berlin", the DST crossings for 2020 are: 2020-03-29 at 02:00 the clock switches to 03:00 (there is no hour 2!) 2020-10-25 at 03:00 the clock switches back to 02:00 (the hour 2 exists two times!) My script yields the following output: MARCH 2020-03-29 01:59:00+01:00 CET plus 1 h: 2020-03-29 02:59:00+01:00 CET (should be 03:59:00

Localized name of ZoneId's ID

ε祈祈猫儿з 提交于 2021-02-19 03:45:08
问题 I have a list of time zones that I want the user to choose from. So, I thought I can just call java.time.ZoneId.getAvailableZoneIds() and use the method getDisplayName on them. This results in a lot of duplicate entries like Central European Time Even if I add the time zone offset they are not unqiue. However, the ID of a ZoneId distinguishes the entries but how can I localize them ? The IDs are always in English like Europe/Rome 回答1: It's possible to get a localized version of the display

java.time.zone.ZoneRulesProvider for Microsoft time-zones

∥☆過路亽.° 提交于 2021-02-19 03:18:55
问题 I am coding against an external API that returns what appear to be windows time-zone descriptions as strings e.g. "Romance Standard Time", and I need to parse these into java ZoneId s or offsets. A list of these values is available here. The java.time.ZoneId documentation states: Time-zone rules are defined by governments and change frequently. There are a number of organizations, known here as groups, that monitor time-zone changes and collate them. The default group is the IANA Time Zone

How do you change the timezone of Sys.time()

我怕爱的太早我们不能终老 提交于 2021-02-18 22:38:49
问题 I am in the PDT timezone and I want to change the variable "s" to the GMT timezone. Any idea how? s<-Sys.time() s as.POSIXct(s,"GMT") OUTPUT > s<-Sys.time() > s [1] "2015-06-17 17:56:17 PDT" > as.POSIXct(s,"GMT") [1] "2015-06-17 17:56:17 PDT" # <-- how do I get this in GMT?? 回答1: Depending on what you want to do exactly, there are a couple of options: s <- Sys.time() s #[1] "2015-06-18 11:21:22 EST" Transfer from local time to GMT, without adustment: as.POSIXct(format(s),tz="GMT") #[1] "2015

How do you change the timezone of Sys.time()

≡放荡痞女 提交于 2021-02-18 22:37:28
问题 I am in the PDT timezone and I want to change the variable "s" to the GMT timezone. Any idea how? s<-Sys.time() s as.POSIXct(s,"GMT") OUTPUT > s<-Sys.time() > s [1] "2015-06-17 17:56:17 PDT" > as.POSIXct(s,"GMT") [1] "2015-06-17 17:56:17 PDT" # <-- how do I get this in GMT?? 回答1: Depending on what you want to do exactly, there are a couple of options: s <- Sys.time() s #[1] "2015-06-18 11:21:22 EST" Transfer from local time to GMT, without adustment: as.POSIXct(format(s),tz="GMT") #[1] "2015

chart.js - display control timescale time zone

谁说胖子不能爱 提交于 2021-02-18 13:06:10
问题 I want to configure one chart to have a different timezone (for example I'm in utc+00 and want to display data in utc+01) Is there a way? according to docs I have to return a moment object, and then date displays according to moment global locale. 回答1: In the time configuration options specify parser as a function: scales: { xAxes: [{ type: 'time', time: { unit: 'hour', min: minDate, max: maxDate, displayFormats: { hour: 'HH' }, parser: function (utcMoment) { return utcMoment.utcOffset('+0100