diff --git a/README.md b/README.md index 0cd9443..8e351c3 100644 --- a/README.md +++ b/README.md @@ -456,8 +456,9 @@ from itertools import product, combinations, combinations_with_replacement, perm Datetime -------- -* **Module 'datetime' provides 'date' ``, 'time' ``, 'datetime' `
` and 'timedelta' `` classes.** -* **Time and datetime can be 'aware' ``, meaning they have defined timezone, or 'naive' ``, meaning they don't.** +* **Module 'datetime' provides 'date' ``, 'time' ``, 'datetime' `
` and 'timedelta' `` classes, all of which are immutable and hashable.** +* **Time and datetime can be 'aware' ``, meaning they have defined timezone, or 'naive' ``, meaning they don't. +* **If object is naive it is presumed to be in system's timezone.** ```python # $ pip3 install pytz @@ -483,6 +484,15 @@ import pytz = DT.now() # Aware datetime from current time. ``` +### Timezone +```python + = pytz.timezone('/') # Use 'pytz.utc' for UTC. + =
.astimezone() # Converts datetime to passed timezone. + = .replace(tzinfo=) # Changes timezone without conversion. + = .utcoffset() # Returns timezone's current offset from UTC. + = .dst() # Returns daylight saving time offset. +``` + ### Encode ```python = D/T/DT.fromisoformat() # From 'YYYY-MM-DD', 'HH:MM:SS.ffffff[+]' or both. @@ -519,15 +529,6 @@ import pytz * **`'z'` - Timezone offset, ± and 4 digits** * **`'Z'` - Timezone name** -### Timezone -```python - = pytz.timezone('/') # Use 'pytz.utc' for UTC. - =
.astimezone() # Converts datetime to passed timezone. - = .replace(tzinfo=) # Changes timezone without conversion. - = .utcoffset() # Returns timezone's current offset from UTC. - = .dst() # Returns daylight saving time offset. -``` - Arguments ---------