You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/python/python-language.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1921,6 +1921,22 @@ _Further Reading_
1921
1921
1922
1922
Python comes with 100s of built-in modules. We'll briefly cover a few that are used often at CWHQ in this section. See the _Further Reading_ section for details on where you can browse all of Python's built-in modules.
1923
1923
1924
+
#### datetime
1925
+
1926
+
The `datetime` module is used to work with times and dates.
1927
+
1928
+
##### `Getting a today's date`
1929
+
1930
+
You use the `date.today()` method to get today's date in the form **YYYY-MM-DD**:
1931
+
1932
+
```python
1933
+
from datetime import date
1934
+
1935
+
# Let's pretend it's February 10, 2023 for this example
1936
+
current_date = date.today()
1937
+
print(current_date) # 2023-02-10
1938
+
```
1939
+
1924
1940
#### random
1925
1941
1926
1942
The `random` module is used to add randomness to your programs.
0 commit comments