Edit elements in a list that contain a date to reformat, however, some elements don't contain dates then having the edited dates replace the old ones

Submitted 3 years, 7 months ago
Ticket #139
Views 242
Language/Framework Python
Priority Medium
Status Closed

[....'1', '2937', '0', '0', 'Sep 10 20:34:44 2020', 'Sep 10 20:35:41 2020', '1', '2978', '0', '0', 'Sep 10 20:34:44 2020', 'Sep 10 20:35:41 2020', '1', '1800', '0', '2'....]

Similar to the formatted list above, I'm trying to extract only the dates which occur two out of every six elements in the list. I would like to take the dates and reformat based on the format listed below using the datetime module. I'm unsure on the best way to go about manipulating the desired elements. Once I have properly edited the dates to my desired format I would like the newly formatted dates to replace the old ones in the list. Any help or ideas on how to best go about this would be greatly appreciated, I've had trouble finding anything online with a similar issue. Thank you.

date_object = datetime.datetime.strptime(dateFromLst, '%b %d %H:%M:%S %Y').strftime('%m/%d/%Y %H:%M:%S %p')

Submitted on Sep 10, 20
add a comment

1 Answer

Verified

As of Excel 2016, there is no way to change the way that Excel auto formats grouped dates in pivot tables.

The workaround is to create a new field/column in the source data file with the desired format and use that in the pivot table.

Submitted 3 years, 6 months ago


Latest Blogs