I receive 2 different formats of datetime in string format. But While storing in PostgreSql Database it has to be stored in UTC format.
Format 1 : 2017-08-25 01:10:56.910523 -04:00
Format 2 : 2017-08-25 01:10:56.910523 AMERICA/NEW_YORK
Tried using timestamptz in PostgreSql but I guess it doesn't seem to understand AMERICA/NEW_YORK so how can to convert and store in UTC format in DB
-4:00 and AMERICA/NEW_YORK are just example but it can be anything else.
dateutil.parser? Here is a link: dateutil.readthedocs.io/en/stable/parser.html It should be not to hard to parse the timezone information and reformat it. Edit: it's actuallyfrom dateutil.tz import gettz