summaryrefslogtreecommitdiff
path: root/date.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2011-03-11 17:31:26 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2011-03-11 17:31:26 +0100
commitf334e2088d11bf25e7180b136a2d73fb8c0ea7c6 (patch)
tree09842e31d742ee0b8064bfca44f22e95c7410e47 /date.py
parenta5f13d728b45a0a53fb78a43bea99921f48cdcc5 (diff)
downloadlogilab-common-f334e2088d11bf25e7180b136a2d73fb8c0ea7c6.tar.gz
new functions to get UTC datetime / time (XXX nothing doing this standardly???)
Diffstat (limited to 'date.py')
-rw-r--r--date.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/date.py b/date.py
index f3c57e9..6fa470d 100644
--- a/date.py
+++ b/date.py
@@ -288,3 +288,9 @@ def ustrftime(somedate, fmt='%Y-%m-%d'):
'S': somedate.second})
fmt = re.sub('%([YmdHMS])', r'%(\1)02d', fmt)
return unicode(fmt) % fields
+
+def utcdatetime(dt):
+ return datetime(*dt.utctimetuple()[:7])
+
+def utctime(dt):
+ return (dt + dt.utcoffset() + dt.dst()).replace(tzinfo=None)