Python iso 8601 to timestamp




















Convert an ISO timestamp to unix timestamp. 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 Show hidden characters. Copy link. So much simpler: If you want to get the seconds since epoch, you can use python-dateutil to convert it to a datetime object and then convert it so seconds using the strftime method.

Sign up for free to join this conversation on GitHub. Already have an account? Better answers welcome! Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years, 6 months ago. Active 3 years, 9 months ago. Viewed 3k times. Note, I'm stuck at Python 2. Could you please revise the title to make it clear what your question actually is - as it stands, this appears to be a duplicate of yesterday's effort. I'm not sure how the title is unclear? Yesterday's question was incorrectly marked as a duplicate - the linked question to that does NOT answer my question - which is how to print the current, local, time with current, local, timezone.

Because, as you actually state in the text of the question, your problem isn't printing the timestamp, it's getting the local tzinfo object. This clarification was added to the previous question only after I closed it. Well, this is getting a bit meta now, but surely the question title should be asking how to solve the problem I want to solve so as to be useful for future people searching for the same problem , rather than the technical detail of part of the solution?

Add a comment. Active Oldest Votes. It supports fractions and timezones, and the T separator all with a single function:. If no timezone is set, iso Notably, if this is None instead of the default, then those timestamps that do not have an explicit timezone are returned as naive datetimes instead:. Example Python has only limited support for parsing ISO timestamps.



0コメント

  • 1000 / 1000