timezone

.NET TimeZoneInfo wrong about Morocco daylight savings

本小妞迷上赌 提交于 2019-12-13 17:57:35
问题 Disclaimer While this question looked like a potential duplicate, it was resolved by referring to IsAmbiguousTime . This does not solve my problem, as the time where I'm noticing discrepancies is not reported to be ambiguous. The question, then... While timeanddate.com says Morocco observes daylight savings between April 3 and July 31 this year, and the current time as provided by worldtimeserver.com seems to imply that this is the case, the .NET TimeZoneInfo does not report Casablanca time

Human readable timezone in python?

£可爱£侵袭症+ 提交于 2019-12-13 16:10:41
问题 How can I get human readable timezone from these timeformat in python? And how can I convert the same time to be in that timezone? 'scheduled_datetime': '2017-07-30T10:00:00+05:30' session.scheduled_datetime datetime.datetime(2017, 7, 30, 10, 0, tzinfo=<DstTzInfo 'Asia/Kolkata' IST+5:30:00 STD>) 回答1: You can do it with iso8601 or dateutil.parser : import iso8601 import dateutil.parser from pytz import timezone fmt = '%Y-%m-%d %H:%M:%S %Z' ist = timezone('Asia/Kolkata') str = '2017-07-30T10:00

How to correctly handle “/Date(…-0700)/” date format from Bing using Moment?

拈花ヽ惹草 提交于 2019-12-13 16:04:24
问题 I'm using the Bing Routes API, and it's returning dates in this kind of format: /Date(1538245980000-0700)/ It looks like Unix timestamp in milliseconds, followed by a timezone. The Moment docs claim to be able to handle these correctly, but they also say that Unix timestamps and Date objects refer to specific points in time, thus it doesn't make sense to use the time zone offset when constructing. Based on other context (it's the time a bus leaves Stawell, a few hours from Melbourne, on

Javascript convert timezone issue

我们两清 提交于 2019-12-13 15:27:06
问题 I am facing an issue in converting datetime in current timzone. I am receiving this date string from server in a format "2015-10-09T08:00:00" which is Central Time but when I convert this date time using new Date(strDate) in GMT+5 its returning me below which is incorrect. var dateObj = '2015-10-09T08:00:00'; new Date(dateObj); // return me below Fri Oct 09 2015 13:00:00 GMT+0500 (PKT) Another way I used is to convert by adding timezone offset and its returning me right result but defiantly

How to update time in lua to reflect system timezone change during execution?

夙愿已清 提交于 2019-12-13 14:33:14
问题 Problem I want to modify the awful.widget.textclock widget in awesome-wm to immediately reflect a change in the system timezone. This widget and all of the awesome-wm config is written in lua. Currently, if the system timezone is changed the widget continues to display the time according to the timezone set at runtime. The widget uses the os.time function to retrieve the time, but this does not match the system time. Solution as provided below lua script: local tz=require"luatz"; require

Convert local time to UTC in .NET framework 3.0

本秂侑毒 提交于 2019-12-13 14:30:21
问题 I develop an app. in c#, I should translate local time to UTC, the local time is in time zone that who that use in my app. enters. I must use in .NET framework 3.0, so can't use the TimeZoneInfo object. Does anyone has an idia how can I do it? Should use in TimeZone Object? Thanks Maybe I can't do it? 回答1: Now I see the problem. Use the following method instead: TimeZone.ToUniversalTime 回答2: every time I save time in a database I ALWAYS save in UTC time myEntity.CreateDate = DateTime.UtcNow;

How to get the beginning of the day in POSIXct

≯℡__Kan透↙ 提交于 2019-12-13 14:15:37
问题 My day starts at 2016-03-02 00:00:00 . Not 2016-03-02 00:00:01 . How do I get the beginning of the day in POSIXct in local time? My confusing probably comes from the fact that R sees this as the end-date of 2016-03-01? Given that R uses an ISO 8601? For example if I try to find the beginning of the day using Sys.Date(): as.POSIXct(Sys.Date(), tz = "CET") "2016-03-01 01:00:00 CET" Which is not correct - but are there other ways? I know I can hack my way out using a simple as.POSIXct(paste(Sys

Is there a portable way to get the local system timezone into a libical icaltimetype?

天大地大妈咪最大 提交于 2019-12-13 12:46:18
问题 libical seems to only accept the Olsen city name to look up timezones in its database. What I've got that's portable is a struct tm which has a GMT offset and the shorthand 3-4 letter code (EST/EDT etc) but there's no function that accepts that in libical. I have a really lousy way where I scan the tz list from libical trying to match the tznames, and that will probably work, but I am well aware this is a bad idea. But I haven't found any other way of getting the local timezone into a libical

How to implement timezone in a web application?

拜拜、爱过 提交于 2019-12-13 12:13:34
问题 I want to implement timezone in my web application. I researched and saw most web app use a GMT dropdown, here is the link to that dropdown http://www.attackwork.com/BlogEntry/6/Time-Zone-Dropdown-Select-List/Default.aspx Then I saw this article suggesting UTC is the way to go when it comes to implement timezone. http://aspnet.4guysfromrolla.com/articles/081507-1.aspx Basically it's saying don't use DateTime.Now instead use DateTime.UtcNow My questions are, Is there a dropdown of the

How to convert user local timestamp to gmt timestamp [duplicate]

隐身守侯 提交于 2019-12-13 10:57:49
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Timezone conversion in php When a user logs in, I save his/her local timezone in session, and set the default php timezone to it: date_default_timezone_set($_SESSION['timezone']); For storing time/date into database, I use GMT timestamp. After user submits a form with a date/time, I use strtotime or mktime to get the timestamp in user's local timezone. How to convert user local timestamp to GMT timestamp ? 回答1: