timezone-offset

Why doesn't C# detect that 1970/1/1 was under BST?

半腔热情 提交于 2019-12-02 03:30:28
I'm working with a 3rd party API that returns Time of Day values as DateTime values filling in Jan 1, 1970 as the date part. So for 5AM, it will return something like 1969-12-31T21:03:00.000-08:00 The problem is that, when if the user was on London time, C# fails to apply BST adjustment for 1970-01-01. For example, 1970-01-01 5AM in UTC should be 1970-01-01 6AM in London. See conversion But, C# doesn't seem to apply this conversion: var utcTime = new DateTime(1970, 1, 1, 5, 0, 0, DateTimeKind.Utc); var britishZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"); var ukTime =

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

折月煮酒 提交于 2019-12-02 02:42:42
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_Angeles"); var zoneChicago = c.GetZoneOrNull("America/Chicago"); var zdtChicago = new ZonedDateTime(

Apply timezone offset to datetime in Python

妖精的绣舞 提交于 2019-12-02 00:41:28
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 resulting timezone is plain UTC ( tzinfo=None )? This feels a bit dirty but it does work from datetime

Showing correct time from Milliseconds with desired TimeZone

前提是你 提交于 2019-12-02 00:04:09
I'm developing an application which takes data from Google TimeZone API . Simply I have time in milliseconds of desired place on Earth. For Example : 1504760156000 it's showing Date time In London which is Thu Sep 07 2017 09:55:56 As I'm in TimeZone +05:00 from UTC if I manipulate 1504760156000 these milliseconds it will show me whole date time like below: Thu Sep 07 2017 09:55:56 GMT+0500 (Pakistan Standard Time) but I want to show: Thu Sep 07 2017 09:55:56 GMT+0100 (British Summer Time) Moral of problem is : I have correct date and time for London but enable to show/change TimeZone without

jQuery.datepicker.formatDate and timezone offset

梦想的初衷 提交于 2019-12-01 20:29:26
问题 To handle dates, i'm using a jQuery UI public method in my application: jQuery.datepicker.formatDate See params & source here : https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js However the wrong date is displayed sometimes, according to the computer timezone. Demo here : http://jsfiddle.net/7ACdB/ With a UTC+1 (paris) timezone in windows, i got : 03/30/20 03/30/20 With a UTC-6 (us&canada) timezone in windows, i got : 03/29/20 <- meh! 03/30/20 You need to restart your

jQuery.datepicker.formatDate and timezone offset

本小妞迷上赌 提交于 2019-12-01 18:39:57
To handle dates, i'm using a jQuery UI public method in my application: jQuery.datepicker.formatDate See params & source here : https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js However the wrong date is displayed sometimes, according to the computer timezone. Demo here : http://jsfiddle.net/7ACdB/ With a UTC+1 (paris) timezone in windows, i got : 03/30/20 03/30/20 With a UTC-6 (us&canada) timezone in windows, i got : 03/29/20 <- meh! 03/30/20 You need to restart your browser (well for google chrome at least) when you change the OS timezone. My problem is the "03/29/20

Why is the timezone off in delayed_job?

爱⌒轻易说出口 提交于 2019-12-01 18:15:45
In my Rails app, when I create a background job using the delayed_job gem, I get all times offset by 6 hours. My understanding is that delayed_job uses your timezone , but it's like it's using the wrong one. Instead of being -6 hours from UTC ( CST is my time zone), it's -12 hours! Here's a bit of view code to illustrate. Note: Time.now gives 2014-03-04 23:26:55 -0600 Time.now.utc gives 2014-03-05 05:26:55 UTC but delayed_job's idea of just a few seconds ago is 2014-03-04 17:26:53 -0600 My View: #delayed_jobs/index.html.erb <h1>All Background Jobs</h1> <p>The time now is: <%= Time.now %> </p>

Why is the timezone off in delayed_job?

℡╲_俬逩灬. 提交于 2019-12-01 17:29:28
问题 In my Rails app, when I create a background job using the delayed_job gem, I get all times offset by 6 hours. My understanding is that delayed_job uses your timezone, but it's like it's using the wrong one. Instead of being -6 hours from UTC (CST is my time zone), it's -12 hours! Here's a bit of view code to illustrate. Note: Time.now gives 2014-03-04 23:26:55 -0600 Time.now.utc gives 2014-03-05 05:26:55 UTC but delayed_job's idea of just a few seconds ago is 2014-03-04 17:26:53 -0600 My View

AngularJS global Date timezone offset

萝らか妹 提交于 2019-12-01 15:45:58
I'm looking to show dates relative to the users' timezones. My hope is that Angular has way to globally config the Date filter to do this—having to do this manually on a case-by-case basis feels wrong. My timestamps are already wrapped in a timestamp() function (simply to multiply by 1000), but I'd prefer not to modify that function if I don't have to. Edit: I'm doing this, and it works, but as stated above, I'd like to set this one level higher if possible $scope.timestamp = function (unix_time) { var epoch = (unix_time * 1000); var date = new Date(); var localOffset = (-1) * date

AngularJS global Date timezone offset

人走茶凉 提交于 2019-12-01 13:51:14
问题 I'm looking to show dates relative to the users' timezones. My hope is that Angular has way to globally config the Date filter to do this—having to do this manually on a case-by-case basis feels wrong. My timestamps are already wrapped in a timestamp() function (simply to multiply by 1000), but I'd prefer not to modify that function if I don't have to. Edit: I'm doing this, and it works, but as stated above, I'd like to set this one level higher if possible $scope.timestamp = function (unix