Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02e0131

Browse files
authored
Merge pull request #4154 from jopemachine/add-utc-alias
Add `datetime.UTC` alias for `datetime.timezone.utc`
2 parents 11a6b73 + 5570ad4 commit 02e0131

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
8-
"MINYEAR", "MAXYEAR")
8+
"MINYEAR", "MAXYEAR", "UTC")
99

1010

1111
import time as _time
@@ -2298,7 +2298,7 @@ def _name_from_offset(delta):
22982298
return f'UTC{sign}{hours:02d}:{minutes:02d}:{seconds:02d}'
22992299
return f'UTC{sign}{hours:02d}:{minutes:02d}'
23002300

2301-
timezone.utc = timezone._create(timedelta(0))
2301+
UTC = timezone.utc = timezone._create(timedelta(0))
23022302
# bpo-37642: These attributes are rounded to the nearest minute for backwards
23032303
# compatibility, even though the constructor will accept a wider range of
23042304
# values. This may change in the future.

0 commit comments

Comments
 (0)