diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2011-03-11 17:31:26 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2011-03-11 17:31:26 +0100 |
commit | f334e2088d11bf25e7180b136a2d73fb8c0ea7c6 (patch) | |
tree | 09842e31d742ee0b8064bfca44f22e95c7410e47 | |
parent | a5f13d728b45a0a53fb78a43bea99921f48cdcc5 (diff) | |
download | logilab-common-f334e2088d11bf25e7180b136a2d73fb8c0ea7c6.tar.gz |
new functions to get UTC datetime / time (XXX nothing doing this standardly???)
-rw-r--r-- | date.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) |