diff --git a/README.md b/README.md index 6cd8e35..9902ef3 100644 --- a/README.md +++ b/README.md @@ -647,11 +647,11 @@ from dateutil.tz import UTC, tzlocal, gettz, datetime_exists, resolve_imaginary ### Format ```python ->>> dt = datetime.strptime('2015-05-14 23:39:00.00 +2000', '%Y-%m-%d %H:%M:%S.%f %z') +>>> dt = datetime.strptime('2015-05-14 23:39:00.00 +0200', '%Y-%m-%d %H:%M:%S.%f %z') >>> dt.strftime("%A, %dth of %B '%y, %I:%M%p %Z") "Thursday, 14th of May '15, 11:39PM UTC+02:00" ``` -* **`'%Z'` only accepts `'UTC/GMT'` and local timezone's code. `'%z'` also accepts `'±HH:MM'`.** +* **Format code `'%z'` accepts `'±HH[:]MM'` and returns `'±HHMM'` (or `''` if datetime is naive).** * **For abbreviated weekday and month use `'%a'` and `'%b'`.** ### Arithmetics diff --git a/index.html b/index.html index 8f4793a..dad4cd6 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
>>> dt = datetime.strptime('2015-05-14 23:39:00.00 +2000', '%Y-%m-%d %H:%M:%S.%f %z')
+Format
>>> dt = datetime.strptime('2015-05-14 23:39:00.00 +0200', '%Y-%m-%d %H:%M:%S.%f %z')
>>> dt.strftime("%A, %dth of %B '%y, %I:%M%p %Z")
"Thursday, 14th of May '15, 11:39PM UTC+02:00"
-'%Z'
only accepts 'UTC/GMT'
and local timezone's code. '%z'
also accepts '±HH:MM'
.
+- Format code
'%z'
accepts '±HH[:]MM'
and returns '±HHMM'
(or ''
if datetime is naive).
- For abbreviated weekday and month use
'%a'
and '%b'
.
Arithmetics
<D/DT> = <D/DT> ± <TD> # Returned datetime can fall into missing hour.
@@ -2934,7 +2934,7 @@ $ pyinstaller script.py --add-data '<path>:.'