All public logs
Jump to navigation
Jump to search
Combined display of all available logs of PeformIQ Upgrade. You can narrow down the view by selecting a log type, the username (case-sensitive), or the affected page (also case-sensitive).
- 10:18, 5 June 2022 PeterHarding talk contribs created page Using Python datetime with Timezones (Created page with " =Explicit Numerical Offsets from UTC= <pre> from datetime import datetime, timezone dt = datetime.now() # This is a naive datetime value print(dt.isoformat()) print(dt.tzinfo) # Cast this as UTC dt = dt.replace(tzinfo=timezone.utc) # Define the offset offset = "+1000" # Convert as so... tz_aware_dt = dt.astimezone(datetime.strptime(offset, "%z").tzinfo) print(tz_aware_dt.isoformat()) </pre> Category:Python Category:datetime Category:EXamples")