The date format returned by the GitHub API is in the format ISO 8601: YYYY-MM-DDTHH:MM:SSZ
To convert this string to a Python date object, use the datetime
module:
import datetime date = datetime.datetime.strptime(<date_string>, "%Y-%m-%dT%H:%M:%SZ")
Then you can parse this string in your chosen format using date.strftime()
:
If you want it to be more βautomatic,β the %c
directive will automatically select a date / time string based on your systemβs language settings and language settings.
If you want to configure it, a complete list of directives can be found here: http://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
source share