I want to parse the date for entries given by SVN:
svn list --xml https://subversion:8765/svn/Foo/tags/
If I am not mistaken it is given using the ISO 8601 standard. An example is:
dateString = "2012-02-14T11:22:34.593750Z"
I am using Python 2.7 and am looking for the best way to process is using the standard modules only. I think I´ll parse it this way using a regular expression: ^---
is a match group and A
indicates that I will assume that they are always there (which might be a weakness)
dateString = "2012-02-14T11:22:34.593750Z"
^--- ^- ^-A^- ^- ^--------A
| |
| I think it always gives the date
| as UTC, which Z means in ISO 8601.
|
Just a separator
After parsing it I´ll simply create a datetime from it.
Is there a better way using Python 2.7 with only the standard modules?
No need for a regexp, use datetime.datetime.strptime()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With