remove Z char (meaning UTC) in received timestamp. fixes #3796

This commit is contained in:
Yann Leboulanger 2008-06-13 15:34:55 +00:00
parent e4aa0de7f7
commit e807c056d3
1 changed files with 3 additions and 0 deletions

View File

@ -1162,10 +1162,13 @@ def datetime_tuple(timestamp):
Because of various datetime formats are used the following exceptions
are handled:
- Optional milliseconds appened to the string are removed
- Optional Z (that means UTC) appened to the string are removed
- XEP-082 datetime strings have all '-' cahrs removed to meet
the above format.'''
timestamp = timestamp.split('.')[0]
timestamp = timestamp.replace('-', '')
timestamp = timestamp.replace('z', '')
timestamp = timestamp.replace('Z', '')
from time import strptime
return strptime(timestamp, '%Y%m%dT%H:%M:%S')