Details
-
Improvement
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Code Clarity
-
Low Hanging Fruit
-
All
-
None
-
Description
Python 3.x introduced many updates to datetime conversion which allows simplified conversions.
1. For example, tracing.py defines a function datetime_from_utc_to_local() but datetime now has a native function astimezone() which will convert UTC to local time.
Review the following users of datetime which apply conversions:
- cqlshmain.py
- formatting.py
- tracing.py
Example:
>>> from dateutil import tz >>> import datetime >>> a = datetime.datetime.now().astimezone(tz.tzutc()) >>> a datetime.datetime(2023, 9, 25, 11, 22, 36, 251705, tzinfo=tzutc()) >>> b = a.astimezone() >>> b datetime.datetime(2023, 9, 25, 14, 22, 36, 251705, tzinfo=datetime.timezone(datetime.timedelta(seconds=10800), 'EST'))
See [PEP 495]
Attachments
Attachments
Issue Links
- links to