Skip to content

Commit 5c74357

Browse files
committed
Datetime fix
1 parent 29fd381 commit 5c74357

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ from itertools import product, combinations, combinations_with_replacement, perm
456456

457457
Datetime
458458
--------
459-
* **Module 'datetime' provides 'date' `<D>`, 'time' `<T>`, 'datetime' `<DT>` and 'timedelta' `<TD>` classes.**
460-
* **Time and datetime can be 'aware' `<a>`, meaning they have defined timezone, or 'naive' `<n>`, meaning they don't.**
459+
* **Module 'datetime' provides 'date' `<D>`, 'time' `<T>`, 'datetime' `<DT>` and 'timedelta' `<TD>` classes, all of which are immutable and hashable.**
460+
* **Time and datetime can be 'aware' `<a>`, meaning they have defined timezone, or 'naive' `<n>`, meaning they don't.
461+
* **If object is naive it is presumed to be in system's timezone.**
461462

462463
```python
463464
# $ pip3 install pytz
@@ -483,6 +484,15 @@ import pytz
483484
<DTa> = DT.now(<tz>) # Aware datetime from current <tz> time.
484485
```
485486

487+
### Timezone
488+
```python
489+
<tz> = pytz.timezone('<Cont.>/<City>') # Use 'pytz.utc' for UTC.
490+
<DTa> = <DT>.astimezone(<tz>) # Converts datetime to passed timezone.
491+
<Ta/DTa> = <T/DT>.replace(tzinfo=<tz>) # Changes timezone without conversion.
492+
<TD> = <T/DT>.utcoffset() # Returns timezone's current offset from UTC.
493+
<TD> = <T/DT>.dst() # Returns daylight saving time offset.
494+
```
495+
486496
### Encode
487497
```python
488498
<D/T/DT> = D/T/DT.fromisoformat(<str>) # From 'YYYY-MM-DD', 'HH:MM:SS.ffffff[+<offset>]' or both.
@@ -519,15 +529,6 @@ import pytz
519529
* **`'z'` - Timezone offset, ± and 4 digits**
520530
* **`'Z'` - Timezone name**
521531

522-
### Timezone
523-
```python
524-
<tz> = pytz.timezone('<Continent>/<City>') # Use 'pytz.utc' for UTC.
525-
<DTa> = <DT>.astimezone(<tz>) # Converts datetime to passed timezone.
526-
<Ta/DTa> = <T/DT>.replace(tzinfo=<tz>) # Changes timezone without conversion.
527-
<timedelta> = <T/DT>.utcoffset() # Returns timezone's current offset from UTC.
528-
<timedelta> = <T/DT>.dst() # Returns daylight saving time offset.
529-
```
530-
531532

532533
Arguments
533534
---------

0 commit comments

Comments
 (0)