Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dateutil to parse the date as the strptime does not support 'Z' time zone offset format #8

Closed
wants to merge 1 commit into from

Conversation

tigeli
Copy link

@tigeli tigeli commented Feb 15, 2021

At least I'm getting timestamps with Z offset while accessing service api with my credentials.

eg. 'parkingTimeUTC': '2021-02-14T20:50:27Z'

@Farfar Farfar self-assigned this Feb 16, 2021
@Farfar
Copy link
Collaborator

Farfar commented Feb 16, 2021

At least I'm getting timestamps with Z offset while accessing service api with my credentials.

eg. 'parkingTimeUTC': '2021-02-14T20:50:27Z'

That looks like the raw data returned from the API, or is this really parsed data?
The API returns timstamps in format '%Y-%m-%dT%H:%M:%S%z' and parsed data is working fine with datetime strptime:

>>> from datetime import date, datetime
>>> val = "2021-02-15T13:14:02Z"
>>> datetime.strptime(val, "%Y-%m-%dT%H:%M:%S%z")
datetime.datetime(2021, 2, 15, 13, 14, 2, tzinfo=datetime.timezone.utc)

@Farfar Farfar added the wontfix This will not be worked on label Feb 16, 2021
@tigeli
Copy link
Author

tigeli commented Feb 16, 2021

At least I'm getting timestamps with Z offset while accessing service api with my credentials.
eg. 'parkingTimeUTC': '2021-02-14T20:50:27Z'
That looks like the raw data returned from the API, or is this really parsed data?

RAW.

The API returns timstamps in format '%Y-%m-%dT%H:%M:%S%z' and parsed data is working fine with datetime strptime:

Yeah, it works python3.7 and newer. I was testing on vm which had 3.6 per default and it doesn't work there. Anyway I will close this as it works on newer python releases.

@tigeli tigeli closed this Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants