aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ganssle <pganssle@users.noreply.github.com>2017-12-06 21:03:22 +0000
committerGitHub <noreply@github.com>2017-12-06 21:03:22 +0000
commitd3100aa6b0e4492b97720733aed04a31497c88dc (patch)
treec1cbb0057ec4a1c57d0e73ca115e60c421acb7ec
parent17afe05f4b0cf4934c5cde9df3f075e9ffef90e4 (diff)
parent26f37ae622b6ad993fa21107300366a7fd338240 (diff)
downloaddateutil-d3100aa6b0e4492b97720733aed04a31497c88dc.tar.gz
Merge pull request #561 from jakec-github/examples
Adds inline example to tzutc class
-rw-r--r--dateutil/tz/tz.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/dateutil/tz/tz.py b/dateutil/tz/tz.py
index eb0ff6f..496148f 100644
--- a/dateutil/tz/tz.py
+++ b/dateutil/tz/tz.py
@@ -38,6 +38,22 @@ class tzutc(datetime.tzinfo):
"""
This is a tzinfo object that represents the UTC time zone.
+ **Examples:**
+
+ .. doctest::
+
+ >>> from datetime import *
+ >>> from dateutil.tz import *
+
+ >>> datetime.now()
+ datetime.datetime(2003, 9, 27, 9, 40, 1, 521290)
+
+ >>> datetime.now(tzutc())
+ datetime.datetime(2003, 9, 27, 12, 40, 12, 156379, tzinfo=tzutc())
+
+ >>> datetime.now(tzutc()).tzname()
+ 'UTC'
+
.. versionchanged:: 2.7.0
``tzutc()`` is now a singleton, so the result of ``tzutc()`` will
always return the same object.