Created
December 31, 2018 16:53
-
-
Save jsnns/92cd570f9a9a0b2c3fa6071119522210 to your computer and use it in GitHub Desktop.
This file contains 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 datetime | |
import pytz | |
import dateutil.parser | |
def to_utc(str, *, zulu_marker=False): | |
# string formats | |
from_format = '%m/%d/%Y %I:%M:%S %p' | |
to_format = '%m/%d/%Y %H:%M:%S' | |
d = datetime.datetime.strptime(datestring, from_format) | |
formated_datetime = d.strftime(to_format) | |
if zulu_marker: | |
formated_datetime += "Z" | |
return formated_datetime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment