datetime_time.py
1 # SPDX-FileCopyrightText: 2001-2021 Python Software Foundation.All rights reserved. 2 # SPDX-FileCopyrightText: 2000 BeOpen.com. All rights reserved. 3 # SPDX-FileCopyrightText: 1995-2001 Corporation for National Research Initiatives. 4 # All rights reserved. 5 # SPDX-FileCopyrightText: 1995-2001 Corporation for National Research Initiatives. 6 # All rights reserved. 7 # SPDX-FileCopyrightText: 1991-1995 Stichting Mathematisch Centrum. All rights reserved. 8 # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries 9 # SPDX-License-Identifier: Python-2.0 10 11 # Example of working with a `time` object 12 # from https://docs.python.org/3/library/datetime.html#examples-of-usage-time 13 from adafruit_datetime import time, timezone 14 15 # Create a new time object 16 t = time(12, 10, 30, tzinfo=timezone.utc) 17 18 # ISO 8601 formatted string 19 iso_time = t.isoformat() 20 print("ISO8601-Formatted Time:", iso_time) 21 22 # Timezone name 23 print("Timezone Name:", t.tzname())