@@ -495,23 +495,35 @@ import pytz
495
495
496
496
### Encode
497
497
``` python
498
- < D/ T/ DT > = D/ T/ DT .fromisoformat(< str > ) # From 'YYYY-MM-DD', 'HH:MM:SS.ffffff[+<offset>]' or both .
499
- < DT > = DT .strptime(< str > , ' <format>' ) # Datetime from string according to < format> .
498
+ < D/ T/ DT > = D/ T/ DT .fromisoformat(< str > ) # From 'YYYY-MM-DD' / 'HH:MM:SS.ffffff[+<offset>]'.
499
+ < DT > = DT .strptime(< str > , ' <format>' ) # Datetime from string according to format.
500
500
< D/ DTn> = D/ DT .fromordinal(< int > ) # Date or datetime from days since Christ.
501
- < D/ DTn> = D/ DT .fromtimestamp(< real> ) # Date or datetime from seconds since Epoch in local time.
502
- < DTn> = DT .utcfromtimestamp(< real> ) # Naive datetime from seconds since Epoch in UTC time.
503
- < DTa> = DT .fromtimestamp(< real> , < tz> ) # Aware datetime from seconds since Epoch in <tz> time.
501
+ < D/ DTn> = D/ DT .fromtimestamp(< real> ) # D/DT from seconds since Epoch in local time.
502
+ < DTn> = DT .utcfromtimestamp(< real> ) # Naive DT from seconds since Epoch in UTC time.
503
+ < DTa> = DT .fromtimestamp(< real> , < tz> ) # Aware DT from seconds since Epoch in tz time.
504
504
```
505
505
* ** On Unix systems Epoch is ` '1970-01-01 00:00 UTC' ` , ` '1970-01-01 01:00 CET' ` , ...**
506
506
507
507
### Decode
508
508
``` python
509
- < str > = < D/ T/ DT > .isoformat() # 'YYYY-MM-DD', 'HH:MM:SS.ffffff[+<offset>]' or both .
510
- < str > = < D/ T/ DT > .strftime(' <format>' ) # Returns customized string representation.
511
- < int > = < D/ DT > .toordinal() # Returns days since Christ ignoring time and timezone.
512
- < float > = < DT > .timestamp() # Returns seconds since Epoch in local time or tz if set.
509
+ < str > = < D/ T/ DT > .isoformat() # 'YYYY-MM-DD' / 'HH:MM:SS.ffffff[+<offset>]'.
510
+ < str > = < D/ T/ DT > .strftime(' <format>' ) # Customized string representation.
511
+ < int > = < D/ DT > .toordinal() # Days since Christ, ignoring time and timezone.
512
+ < float > = < DT > .timestamp() # Seconds since Epoch in local time or tz if set.
513
513
```
514
514
515
+ ### ISO Format
516
+ ``` python
517
+ date == ' YYYY-MM-DD'
518
+ time == ' HH:MM:SS.ffffff[+<offset>]'
519
+ datetime == ' YYYY-MM-DDTHH:MM:SS.ffffff[+<offset>]'
520
+ ```
521
+
522
+ * ** Date: ` 'YYYY-MM-DD' ` .**
523
+ * ** Time: ` 'HH:MM:SS.ffffff[+<offset>]' ` .**
524
+ * ** Datetime: ` 'YYYY-MM-DDTHH:MM:SS.ffffff[+<offset>]' ` .**
525
+
526
+
515
527
### Format
516
528
``` python
517
529
>> > dt = datetime.strptime(' 2015-05-14 23:39:00' , ' %Y-%m-%d %H:%M:%S' )
0 commit comments