diff --git a/rq/utils.py b/rq/utils.py index 7fd1b1e2..30e99051 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -180,7 +180,11 @@ def utcformat(dt): def utcparse(string): - return datetime.datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ") + try: + return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%SZ') + except ValueError: + # This catches RQ < 0.4 datetime format + return datetime.datetime.strptime(string, '%Y-%m-%dT%H:%M:%S.%f+00:00') def first(iterable, default=None, key=None):