timezone

momentjs: how to get the date in a specific timezone

故事扮演 提交于 2019-12-10 18:48:53
问题 In a nutshell I want moment to respect server's timezone. I've set my machine's timezone to Alaska but I'm passing a Brisbane timezone string to moment. Now I need moment.toDate to return a date instance in the same timezone as the one I pass in the moment constructor; e.g. m = moment("2016-11-20T08:00:00+10:00") m.format() // "2016-11-20T08:00:00+10:00" m.toDate() // Sat Nov 19 2016 13:00:00 GMT-0900 (AKST) I want to get a Date instance from moment that's in the input timezone; e.g. somehow

Is it possible to get a timezone in Python given a UTC timestamp and a UTC offset?

六眼飞鱼酱① 提交于 2019-12-10 18:39:44
问题 I have data that is the UTC offset and the UTC time. Given that, is it possible in Python to get the user's local timezone (mainly to figure if it is DST etc. probably using pytz), similar to the function in PHP timezone_name_from_abbr ? For example: If my epoch time is 1238720309, I can get the UTC time as: >>> d = datetime.utcfromtimestamp(1238720309) >>> print d + dt.timedelta(0,-28800) #offset for pacific I think 2009-04-02 17:04:41.712143 This is correct except it is PDT right now, so it

How to convert string with timezone to datetime in utc with python?

♀尐吖头ヾ 提交于 2019-12-10 18:33:02
问题 I am new Python . I am stuck at one point. I have variable that store time as string with specified timezone. It is look like as given below >>> print usertime 2017-08-18T08:00:00+04:30 >>> type(usertime) <type 'str'> So I just want to convert usertime time to utc time, The output should subtract 4 hours and 30 minutes from 2017-08-18T08:00:00 . The output conversion will look like: 2017-08-18T03:30:00 as per utc format. 回答1: You want to convert the string to a datetime like object first. The

What's wrong with '2018-03-22 00:00:00" in MySQL?

扶醉桌前 提交于 2019-12-10 18:31:19
问题 I want to update a date field and set it to 2018-03-22 00:00:00 but I get the following stupid error: Error Code: 1292. Incorrect datetime value: '2018-03-22 00:00:00' for column 'Date' at row 158917 This is the query I use for updating: update assets.transactions set date = date_add(date, interval 1 hour) where date between '2018-03-21 23:00:00' and '2018-06-29 23:59:59'; What is wrong? I searched a lot and found out dates before 1970-01-01 00:00:01 are not supported by MySQL, that is

System.TimeZoneNotFoundException error while getting datetime for particular time zone in c#

妖精的绣舞 提交于 2019-12-10 18:27:48
问题 I've a JSON file which has time_zone parameter. It has values like London, Casablanca, Arizona, Pacific Time (US & Canada) etc. Based on the time_zone , I want to get the DateTime result of that time zone. For example, Current time = 8/3/2015 4:00:00 PM If time_zone = Central Time (US & Canada) then result should be 8/3/2015 3:00:00 PM, If time_zone = Pacific Time (US & Canada) then result should be 8/3/2015 1:00:00 PM, If time_zone = London then result should be 8/3/2015 9:00:00 PM and so on

Convert Pandas DF column from UTC to US-Eastern time without date

女生的网名这么多〃 提交于 2019-12-10 18:21:39
问题 I have this Pandas dataframe column: time_UTC 0 2015-01-05 16:44:34+00:00 1 2015-08-11 16:44:38+00:00 2 2015-08-02 16:53:25+00:00 3 2015-08-17 16:53:25+00:00 4 2015-09-28 16:53:26+00:00 Name: time_UTC, dtype: datetime64[ns, UTC] and I converted it from UTC to US-Eastern timezone using: list_temp = [] for row in df['time_UTC']: list_temp.append(Timestamp(row, tz = 'UTC').tz_convert('US/Eastern')) df['time_EST'] = list_temp to get this: 0 2015-01-05 11:44:34-05:00 1 2015-08-11 11:44:38-05:00 2

Azure time zone and javascriptserializer object

℡╲_俬逩灬. 提交于 2019-12-10 18:17:41
问题 I have a predictions-based app that's up on Windows Azure ( http://ipredikt.com ). From what I can tell Azure's clock is synchronized to the GMT time zone. Here is a problem that I am encountering: Let's say I have a DB field called CreateDate of type DateTime and I set its value to June 10, 2011, 12:30am. when a new prediction is created. If I peek inside the db table the date is correctly set. I don't touch or change this value in any way. However, when I read the value with our API,

Facebook API, timezone and country

对着背影说爱祢 提交于 2019-12-10 18:16:08
问题 I am developing a website where the users can log in with their Facebook credentials. Now I am facing an issue with Date and Times. My local system uses the "Romance Standard Time" which is different to what Facebook uses. Where I am locally we use DST and depending on the time of the year we can either be at UTC + 1 or UTC + 2. My question is, "How can I translate the Facebook times into the format my local system will use, taking into account the occasional change between UTC+1 and UTC+2?"

String to UTC Time conversion

痞子三分冷 提交于 2019-12-10 18:08:47
问题 I am getting mail archives with dates like this in it. Wed, 17 Dec 1997 13:36:23 +2 Mon, 16 Jun 1997 15:41:52 EST Tue, 15 Jul 1997 14:37:00 EDT Tue, 5 Aug 1997 08:37:56 PST Tue, 5 Aug 1997 15:46:16 PDT Thu, 5 Mar 1998 08:44:19 MET Mon, 8 Nov 1999 17:49:25 GMT Thu, 24 Feb 94 20:06:06 MST Mon, 19 Dec 2005 14:17:06 CST Thu, 14 Sep 95 19:15 CDT Sat, 22 Feb 1997 05:16:55 UT Mon, 8 Jul 1996 15:48:54 GMT-5 Mon, 25 Nov 1996 17:10:28 WET Mon, 6 Jan 1997 23:43:48 UT Fri, 13 Jun 1997 16:44:03 -0400 Ask

.NET TimeZone.CurrentTimeZone.GetDaylightChanges returns wrong DST for 2005

别说谁变了你拦得住时间么 提交于 2019-12-10 17:55:25
问题 I used the following code to display the Daylight Saving Time for the years between 2005 and 2035. For the year 2005, this page shows the DST is between April 3rd and October 30th. But the GetDaylightChanges returns March 13 and November 6th. Is the .NET GetDaylightChanges a reliable function? public static void GetCurrentTimeZone() { for (int i = 0; i < 30; i++) { var dlt = TimeZone.CurrentTimeZone.GetDaylightChanges(2005 + i); Console.WriteLine(2005 + i); Console.WriteLine(dlt.Start