@@ -456,8 +456,9 @@ from itertools import product, combinations, combinations_with_replacement, perm
456
456
457
457
Datetime
458
458
--------
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.**
461
462
462
463
``` python
463
464
# $ pip3 install pytz
@@ -483,6 +484,15 @@ import pytz
483
484
< DTa> = DT .now(< tz> ) # Aware datetime from current <tz> time.
484
485
```
485
486
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
+
486
496
### Encode
487
497
``` python
488
498
< 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
519
529
* ** ` 'z' ` - Timezone offset, ± and 4 digits**
520
530
* ** ` 'Z' ` - Timezone name**
521
531
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
-
531
532
532
533
Arguments
533
534
---------
0 commit comments