I have a javascript date object, which i turn into a string, and send to my backend to parse using python.
here is an example of the javascript date string 'Mon Aug 18 2014 21:11:54 GMT+0200 (Centraleuropæisk sommertid)
I have made a python helper function to help parse the date.
def datetime_converter(datetime_str):
return datetime.strptime(datetime_str, "%a, %d %b %Y %H:%M:%S %Z")
this should correctly parse the date according to this answer
i think the problem is that there is an extra text attached to the end (It's danish since I'm from Denmark)
(Centraleuropæisk sommertid)
does anybody know a workaround for this?
i could split the string for a (
but that does not seem like a good solution.
Here is the exception i get data 'Mon Aug 18 2014 21:11:54 GMT+0200 (Centraleuropæisk sommertid)' does not match format '%a, %d %b %Y %H:%M:%S %Z'