Skip to content

Instantly share code, notes, and snippets.

@mrroot5
Last active December 23, 2020 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrroot5/c97af91645399209f948f80be46a8f6b to your computer and use it in GitHub Desktop.
Save mrroot5/c97af91645399209f948f80be46a8f6b to your computer and use it in GitHub Desktop.
Create datetime with django date settings. Keywords: django, django dates, django datetime, django date settings, django create date with default settings
import dateutil.parser
datetime_str_with_offset = '2025-08-25 11:47:58-01'
dateutil.parser.parse(datetime_str_with_offset)
# Output
# datetime.datetime(2025, 8, 25, 11, 47, 58, tzinfo=tzoffset(None, -3600))
python-dateutil==2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment