Skip to content

Commit

Permalink
Added timezone remover
Browse files Browse the repository at this point in the history
In the timestamp_to_datetime method, the timezone clarifier (Z) is removed from the time portion of the timestamp.
  • Loading branch information
Jonah Pierce authored Mar 2, 2019
1 parent 802a619 commit c6d3f80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def timestamp_to_datetime(timestamp):

# Get the date and time
date = timestamp.split("T")[0].split("-")
time = timestamp.split("T")[1].split(":")
time = timestamp.split("T")[1].replace("Z", "").split(":")

# Turn it into a datetime
dateTime = datetime(
Expand Down Expand Up @@ -122,4 +122,4 @@ def generate_random_string():

# Choose random length
length = randint(10, 100)
return "".join([choice(characters) for i in range(length)])
return "".join([choice(characters) for i in range(length)])

2 comments on commit c6d3f80

@fifiinart
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FellowHashbrown what's this for?

@xastrobyte
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fifiinart sorry for the late reply. This removes the timezone indicator if there is any in a timestamp in the format MM-DD-YYYYTHH:MM:SSZ where Z is the time zone offset from UTC.

Please sign in to comment.