datetime-format

pandas format datetimeindex to quarters

[亡魂溺海] 提交于 2020-04-13 17:14:29
问题 With a resample job, I have my monthly values converted to quarterly values: hs=hs.resample('QS',axis=1).mean() Works well, my columns look like this: hs.columns: DatetimeIndex(['2000-01-01', '2000-04-01', '2000-07-01', '2000-10-01', '2001-01-01', '2001-04-01', '2001-07-01', '2001-10-01', '2002-01-01', '2002-04-01', '2002-07-01', '2002-10-01', Now I want them to convert in the YYYYq[1-4] format, which I thought should be as easy as (according to this Link): hs.columns.strftime('%Yq%q') But

how to convert UTC date-time into ISO 8601 format in Java?

て烟熏妆下的殇ゞ 提交于 2020-03-03 07:43:25
问题 I want to format a UTC date-time in a specific ISO 8601 format like 2020-02-28T14:10:23+00:00 but not 2020-02-28T14:10:23Z . I don't want Z at the end but +00:00. I tried all the formats in simpleDateFormat doc and no format seems to give the above-mentioned one. I know both represents same time irrespective of the format but it needs to be formatted like that for backward compatibility reasons. Here is the java code that I tried, final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd

Datetime from year and week number

放肆的年华 提交于 2020-02-02 02:42:26
问题 I have a year and a week number which I want to convert into a datetime.datetiem object. My (naive?) reading of the documentation hinted that strptime('2016 00', '%Y %W') should do just that. However: In [2]: from datetime import datetime In [3]: datetime.strptime('2016 00', '%Y %W') Out[3]: datetime(2016, 1, 1, 0, 0) In [4]: datetime.strptime('2016 52', '%Y %W') Out[4]: datetime(2016, 1, 1, 0, 0) What am I doing wrong? 回答1: So it turns out that the week number isn't enough for strptime to

ZonedDateTime ignores 00 for ss part

杀马特。学长 韩版系。学妹 提交于 2020-01-30 12:23:51
问题 I am trying to convert string value "2018-10-11T12:00:00Z"; to ZonedDateTime. If I use the default ZonedDateTime.parse(zonedDateTime) then ss portion i.e. 00 is removed and I get "2018-10-11T12:00Z" as output. Can you please help how to retain 00 as SS part. String zonedDateTime = "2018-10-11T12:00:00Z"; ZonedDateTime z = ZonedDateTime.parse(zonedDateTime); System.out.println(z); // return 2018-10-11T12:00Z ZonedDateTime z1 = ZonedDateTime.parse (zonedDateTime, DateTimeFormatter.ofPattern(

getvalues() returns a complete date in the year 1899 for a cell containing only time

岁酱吖の 提交于 2020-01-30 11:58:46
问题 If we have only a time in say cell A1 of Google sheets. For example, I have this: 8:09:00 AM When I use this to fetch the contents of the cell: sheet.getRange(1, 1).getValue(); this is what it returns: Sat Dec 30 1899 08:09:00 GMT-0500 (EST) Why is this happening? Any way for getvalue() to stop interpreting the data and get the raw data instead? Note: No special formatting has been set by me for the cell. So I guess the formating is the default (automatic), which is not something I want to

getvalues() returns a complete date in the year 1899 for a cell containing only time

≡放荡痞女 提交于 2020-01-30 11:58:05
问题 If we have only a time in say cell A1 of Google sheets. For example, I have this: 8:09:00 AM When I use this to fetch the contents of the cell: sheet.getRange(1, 1).getValue(); this is what it returns: Sat Dec 30 1899 08:09:00 GMT-0500 (EST) Why is this happening? Any way for getvalue() to stop interpreting the data and get the raw data instead? Note: No special formatting has been set by me for the cell. So I guess the formating is the default (automatic), which is not something I want to

Java Date Time conversion to given timezone

被刻印的时光 ゝ 提交于 2020-01-30 07:03:07
问题 I have a DateTime in the format of Tue, 30 Apr 2019 16:00:00 +0800 which is RFC 2822 formatted date I need to convert this to the given timezone in the DateTime which is +0800 So if i summarized, DateGiven = Tue, 30 Apr 2019 16:00:00 +0800 DateWanted = 01-05-2019 00:00:00 How can i achieve this in Java? I have tried the below code but it gives 08 hours lesser than the current time which is 30-04-2019 08:00:00 Code i tried String pattern = "EEE, dd MMM yyyy HH:mm:ss Z"; SimpleDateFormat format

DataGridView DateTimePicker Column - add Long Format support (Date and the Time)

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 07:09:29
问题 I'm trying to make gridview Datetimepicker column and i succeeded, but i have a little problem that when the user edit the date in the gridview the date appear in short "11/9/16" but what i want is the date and the time together"11/9/16 2:34:45 AM" This is the code I use: CalendarColumn: Imports System Imports System.Windows.Forms Public Class CalendarColumn Inherits DataGridViewColumn Public Sub New() MyBase.New(New CalendarCell()) End Sub Public Overrides Property CellTemplate() As

DataGridView DateTimePicker Column - add Long Format support (Date and the Time)

自古美人都是妖i 提交于 2020-01-25 07:09:17
问题 I'm trying to make gridview Datetimepicker column and i succeeded, but i have a little problem that when the user edit the date in the gridview the date appear in short "11/9/16" but what i want is the date and the time together"11/9/16 2:34:45 AM" This is the code I use: CalendarColumn: Imports System Imports System.Windows.Forms Public Class CalendarColumn Inherits DataGridViewColumn Public Sub New() MyBase.New(New CalendarCell()) End Sub Public Overrides Property CellTemplate() As

DateTimeFormatter adding a year to date after formatting [duplicate]

半城伤御伤魂 提交于 2020-01-24 11:30:19
问题 This question already has answers here : Why does Java's java.time.format.DateTimeFormatter#format(LocalDateTime) add a year? (1 answer) Using DateTimeFormatter on january first cause an invalid year value (1 answer) Closed last month . I am trying to convert a date of the format 2019-12-30 to a date with format 30-12-2019 and for this I thought of using DateTimeFormatter and I have the following code for this: LocalDate date = LocalDate.parse("2019-12-30"); DateTimeFormatter formatter =