merge from jktest7
[sfa.git] / sfa / util / sfatime.py
1 import dateutil.parser
2
3 def utcparse(str):
4     """ Translate a string into a time using dateutil.parser.parse but make sure it's in UTC time and strip
5     the timezone, so that it's compatible with normal datetime.datetime objects"""
6     
7     t = dateutil.parser.parse(str)
8     if not t.utcoffset() is None:
9         t = t.utcoffset() + t.replace(tzinfo=None)
10     return t