Skip to content

Commit abd4542

Browse files
committed
📝 Add common datetime strings
1 parent 7504e2d commit abd4542

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

docs/types/strings/print.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ F-string:
205205
>>> print(f"My name is {uid.capitalize()=}")
206206
My name is uid.capitalize()='Veit'
207207
208-
Formatting date and time formats and IP addresses
209-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208+
Formatting date and time formats
209+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210210

211211
:py:mod:`datetime` supports the formatting of strings using the same syntax as
212212
the :py:meth:`strftime <datetime.datetime.strftime>` method for these objects.
@@ -220,7 +220,18 @@ the :py:meth:`strftime <datetime.datetime.strftime>` method for these objects.
220220
'de_DE.utf-8'
221221
>>> today = datetime.date.today()
222222
>>> print(f"Heute ist {today:%A, %d. %B %Y}.")
223-
Heute ist Dienstag, 25. November 2025.
223+
Heute ist Freitag, 11. Juli 2025.
224+
225+
.. csv-table:: Häufige Formatierungen
226+
:header: "Beschreibung", "Beispiel", "Format"
227+
228+
ISO 8601, "2025-07-11T18:46:49", "%Y-%m-%dT%H:%M:%S"
229+
ISO 8601 with time zone, "2025-07-11T18:46:49+0100", "%Y-%m-%dT%H:%M:%S%z"
230+
RFC 2822, "Fr, 11 Jul 2025 18:46:49", "%a, %d %b %Y %H:%M:%S"
231+
RFC 3339 with time zone, "2025-07-11 18:46:49+0100", "%Y-%m-%d %H:%M:%S%z"
232+
233+
Formatting IP addresses
234+
~~~~~~~~~~~~~~~~~~~~~~~
224235

225236
The :py:mod:`ipaddress` module of Python also supports the formatting of
226237
``IPv4Address`` and ``IPv6Address`` objects.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ docs = [
4949
]
5050

5151
[tool.codespell]
52-
ignore-words-list = "ist, symbl, allo"
52+
ignore-words-list = "allo, ist, Juli, symbl"

0 commit comments

Comments
 (0)