timezone-offset

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

心已入冬 提交于 2019-12-05 09:04:46
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 it display different results on local and dedicated server on localhost (192.168.x.x) mysql version : 5

Django default=timezone.now + delta

大兔子大兔子 提交于 2019-12-04 22:18:46
Trying to set a timestamp for a key expiration in Django model and bumped into this issue : My current code : key_expires = models.DateTimeField(default=timezone.now() + timezone.timedelta(days=1)) The code above works, however when "timezone.now()" is used, it gets the timestamp form the time when Apache was restarted, so this doesn't work. I did some research and found the solution for that part of the issue, so by replacing "timezone.now()" with "timezone.now", I'm getting the current time stamp every time the object is created, which is perfect, issue is partially solved. I'm having

Show the : character in the timezone offset using datetime.strftime [duplicate]

半城伤御伤魂 提交于 2019-12-04 11:09:38
This question already has an answer here: How to parse str(my_datetime) using strptime ? 2 answers What is the format string to give to strftime which would give the same output as I see for isoformat(' ') ? >>> from datetime import datetime >>> import pytz >>> dt = datetime.now(tz=pytz.UTC).replace(microsecond=0) >>> print dt 2014-05-29 13:11:00+00:00 >>> dt.isoformat(' ') '2014-05-29 13:11:00+00:00' >>> dt.strftime('%Y-%m-%d %H:%M:%S%z') '2014-05-29 13:11:00+0000' Where does the __str__ behaviour of datetime get that extra colon in the offset from? I looked in the formatting options and

How do I convert UTC/ GMT datetime to CST in Javascript? (not local, CST always)

回眸只為那壹抹淺笑 提交于 2019-12-04 05:55:39
I have a challenge where backend data is always stored in UTC time. Our front-end data is always presented in CST. I don't have access to this 'black box.' I would like to mirror this in our data warehouse. Which is based in Europe (CET). So "local" conversion will not work. I'm wondering the simplest, most straightforward way to accurately convert UTC time (I can have it in epoch milliseconds or a date format '2015-01-01 00:00:00') to Central Standard Time. (which is 5 or 6 hours behind based on Daylight Savings). I see a lot of threads about converting to 'local' time ... again I don't want

In Go, how can I extract the value of my current local time offset?

馋奶兔 提交于 2019-12-04 05:00:17
I'm a Go newbie, and I'm struggling a bit trying to format and display some IBM mainframe TOD clock data. I want to format the data in both GMT and local time (as the default -- otherwise in the zone the user specifies). For this, I need to get the value of the local time offset from GMT as a signed integer number of seconds. In zoneinfo.go (which I confess I don't fully understand), I can see // A zone represents a single time zone such as CEST or CET. type zone struct { name string // abbreviated name, "CET" offset int // seconds east of UTC isDST bool // is this zone Daylight Savings Time?

TZupdater failing with tzdata2016g release

六月ゝ 毕业季﹏ 提交于 2019-12-04 00:32:31
问题 TZUpdater 2.1.0 is failing with tzdata2016g release. For Java 8 it fails with "Source directory does not contain file: VERSION" error, while it completes with "JRE updated to version : tzdataunknown" comment for Java 7. The reason of this seems to be recent change of IANA tzdata distribution: Unsetting VERSION field of Makefile. There is a bug reported regarding the issue: https://bugs.openjdk.java.net/browse/JDK-8166928. DST date(30th October 2016) is getting closer and we at least need a

Converting between time zones with Noda Time

ε祈祈猫儿з 提交于 2019-12-03 05:10:18
I'm currently trying to ensure that our legacy back-end can support resolving date times based on the user's current time zone (or, more specifically offset). Our servers are in eastern standard time, and most of our date times originate there. However, for users that are in other time zones, a conversion to their time zone (or, in this case, offset) is needed when retrieving those date times. Also, date times coming from the user will have to be converted to eastern standard time before persistence on the server. Given that the front end we are developing is web-based, I am able to retrieve

Determine how to calculate times across different timezones using nodaTime and withZone on ZoneDateTime

强颜欢笑 提交于 2019-12-02 06:28:04
问题 When converting times between time zones. I found the follow code works. However I am not sure how programmatically what to put as my offset for the constructor for the ZonedDateTime . I had a choice of one of the offsets on zoneChicago, which is just two, because its either with our without daylight savings, but how do I know which one I use, and for timezones that have more then just two, what is the best way to populate that offset? Thanks, Jim var zoneLA = c.GetZoneOrNull("America/Los

Apply timezone offset to datetime in Python

风格不统一 提交于 2019-12-02 05:20:27
问题 For a given date string such as 2009-01-01T12:00:00+0100 I want the UTC datetime object. from datetime import datetime datetime.strptime("2013-03-21T14:19:42+0100", "%Y-%m-%dT%H:%M:%S%z") returns datetime.datetime(2013, 3, 21, 14, 19, 42, tzinfo=datetime.timezone(datetime.timedelta(0, 3600))) I cannot believe there is no method in datetime or pandas for applying the timezone-related offset to the datetime and returning plain UTC datetime. How can I apply the tzinfo offset/delta, so that the

How to construct time.Time with timezone offset in Go

天涯浪子 提交于 2019-12-02 03:32:56
This is an example date from an Apache log: [07/Mar/2004:16:47:46 -0800] I have successfully parsed this into year(int), month(time.Month), day(int), hour(int), minute(int), second(int), and timezone(string). How can I construct time.Time such that it includes the -0800 time zone offset? This is what I have so far: var nativeDate time.Time nativeDate = time.Date(year, time.Month(month), day, hour, minute, second, 0, ????) What should I use in place of ???? ? time.Local or time.UTC is not appropriate here. You may use time.FixedZone() to construct a time.Location with a fixed offset. Example: