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: README.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -563,7 +563,7 @@ from dateutil.tz import UTC, tzlocal, gettz
563
563
<DTn>=DT.utcnow() # Naive datetime from current UTC time.
564
564
<DTa>=DT.now(<tzinfo>) # Aware datetime from current tz time.
565
565
```
566
-
***To extract time use `'<DTn>.time()'` or `'<DTa>.timetz()'`.**
566
+
***To extract time use `'<DTn>.time()'`, `'<DTa>.time()'` or `'<DTa>.timetz()'`.**
567
567
568
568
### Timezone
569
569
```python
@@ -581,8 +581,9 @@ from dateutil.tz import UTC, tzlocal, gettz
581
581
```python
582
582
<D/T/DT>= D/T/DT.fromisoformat('<iso>') # Object from ISO string.
583
583
<DT>=DT.strptime(<str>, '<format>') # Datetime from str, according to format.
584
-
<D/DTn>= D/DT.fromordinal(<int>) # D/DTn from days since Christ.
585
-
<DTa>=DT.fromtimestamp(<real>, <tz.>) # DTa from seconds since Epoch in tz time.
584
+
<D/DTn>= D/DT.fromordinal(<int>) # D/DTn from days since Christ, at midnight.
585
+
<DTn>=DT.fromtimestamp(<real>) # Local time DTn from seconds since Epoch.
586
+
<DTa>=DT.fromtimestamp(<real>, <tz.>) # Aware datetime from seconds since Epoch.
586
587
```
587
588
***ISO strings come in following forms: `'YYYY-MM-DD'`, `'HH:MM:SS.ffffff[±<offset>]'`, or both separated by `'T'`. Offset is formatted as: `'HH:MM'`.**
588
589
***On Unix systems Epoch is `'1970-01-01 00:00 UTC'`, `'1970-01-01 01:00 CET'`, ...**
@@ -592,7 +593,8 @@ from dateutil.tz import UTC, tzlocal, gettz
592
593
<str>=<D/T/DT>.isoformat() # ISO string representation.
Copy file name to clipboardExpand all lines: index.html
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -602,7 +602,7 @@ <h3 id="now">Now</h3>
602
602
<DTa> = DT.now(<tzinfo>) <spanclass="hljs-comment"># Aware datetime from current tz time.</span>
603
603
</code></pre>
604
604
<ul>
605
-
<li><strong>To extract time use <codeclass="python hljs"><spanclass="hljs-string">'<DTn>.time()'</span></code> or <codeclass="python hljs"><spanclass="hljs-string">'<DTa>.timetz()'</span></code>.</strong></li>
605
+
<li><strong>To extract time use <codeclass="python hljs"><spanclass="hljs-string">'<DTn>.time()'</span></code>, <codeclass="python hljs"><spanclass="hljs-string">'<DTa>.time()'</span></code> or <codeclass="python hljs"><spanclass="hljs-string">'<DTa>.timetz()'</span></code>.</strong></li>
606
606
</ul>
607
607
<h3id="timezone">Timezone</h3>
608
608
<pre><codeclass="python language-python hljs"><tzinfo> = UTC <spanclass="hljs-comment"># UTC timezone. London without DST.</span>
<pre><codeclass="python language-python apache hljs"><D/T/DT> = D/T/DT.fromisoformat(<spanclass="hljs-string">'<iso>'</span>) <spanclass="hljs-comment"># Object from ISO string.</span>
617
617
<DT> = DT.strptime(<str>, <spanclass="hljs-string">'<format>'</span>) <spanclass="hljs-comment"># Datetime from str, according to format.</span>
618
-
<D/DTn> = D/DT.fromordinal(<int>) <spanclass="hljs-comment"># D/DTn from days since Christ.</span>
619
-
<DTa> = DT.fromtimestamp(<real>, <tz.>) <spanclass="hljs-comment"># DTa from seconds since Epoch in tz time.</span>
618
+
<D/DTn> = D/DT.fromordinal(<int>) <spanclass="hljs-comment"># D/DTn from days since Christ, at midnight.</span>
619
+
<DTn> = DT.fromtimestamp(<real>) <spanclass="hljs-comment"># Local time DTn from seconds since Epoch.</span>
620
+
<DTa> = DT.fromtimestamp(<real>, <tz.>) <spanclass="hljs-comment"># Aware datetime from seconds since Epoch.</span>
620
621
</code></pre>
621
622
<ul>
622
623
<li><strong>ISO strings come in following forms: <codeclass="python hljs"><spanclass="hljs-string">'YYYY-MM-DD'</span></code>, <codeclass="python hljs"><spanclass="hljs-string">'HH:MM:SS.ffffff[±<offset>]'</span></code>, or both separated by <codeclass="python hljs"><spanclass="hljs-string">'T'</span></code>. Offset is formatted as: <codeclass="python hljs"><spanclass="hljs-string">'HH:MM'</span></code>.</strong></li>
623
624
<li><strong>On Unix systems Epoch is <codeclass="python hljs"><spanclass="hljs-string">'1970-01-01 00:00 UTC'</span></code>, <codeclass="python hljs"><spanclass="hljs-string">'1970-01-01 01:00 CET'</span></code>, …</strong></li>
624
625
</ul>
625
626
<h3id="decode">Decode</h3>
626
-
<pre><codeclass="python language-python apache hljs"><str> = <D/T/DT>.isoformat() <spanclass="hljs-comment"># ISO string representation.</span>
627
+
<pre><codeclass="python language-python hljs"><str> = <D/T/DT>.isoformat() <spanclass="hljs-comment"># ISO string representation.</span>
0 commit comments