Skip to content

Commit 1d4ca3f

Browse files
finishing tox unit tests
1 parent fe4d7d2 commit 1d4ca3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

SoftLayer/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,9 @@ def clean_time(sltime, in_format='%Y-%m-%dT%H:%M:%S%z', out_format='%Y-%m-%d %H:
297297
:param string in_format: Datetime format for strptime
298298
:param string out_format: Datetime format for strftime
299299
"""
300-
clean = datetime.datetime.strptime(sltime, in_format)
301-
return clean.strftime(out_format)
300+
try:
301+
clean = datetime.datetime.strptime(sltime, in_format)
302+
return clean.strftime(out_format)
303+
# The %z option only exists with py3.6+
304+
except ValueError:
305+
return sltime

0 commit comments

Comments
 (0)