Created
September 25, 2024 03:47
-
-
Save mschulz/10910f4553ada9ba07b5a46642391825 to your computer and use it in GitHub Desktop.
JSON loads of date time item
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jsondatetime as json | |
>>> test = '{"name": "John Doe", "born": "Thu, 1 Mar 2012 10:00:49 UTC"}' | |
>>> json.loads(test) | |
{'name': 'John Doe', 'born': datetime.datetime(2012, 3, 1, 10, 0 ,49)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation: pip install json-datetime
Strings are parsed using dateutil.parser.parse which is fairly flexible for common datetime formats