You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Brandon Williams (Jira)" <ji...@apache.org> on 2024/03/06 01:44:00 UTC
[jira] [Updated] (CASSANDRA-18879) Modernize CQLSH datetime conversions
[ https://issues.apache.org/jira/browse/CASSANDRA-18879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brandon Williams updated CASSANDRA-18879:
-----------------------------------------
Reviewers: Brandon Williams
> Modernize CQLSH datetime conversions
> ------------------------------------
>
> Key: CASSANDRA-18879
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18879
> Project: Cassandra
> Issue Type: Improvement
> Components: CQL/Interpreter
> Reporter: Brad Schoening
> Assignee: Arun Ganesh
> Priority: Low
> Attachments: cassandra-cqlsh-stdout
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> 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:
> {code:java}
> >>> 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')) {code}
> See [[PEP 495|http://example.com]]]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org