diff --git a/README.rst b/README.rst index a7e0316..b1c0837 100644 --- a/README.rst +++ b/README.rst @@ -62,7 +62,7 @@ Usage Example # Example of working with a `datetime` object # from https://docs.python.org/3/library/datetime.html#examples-of-usage-datetime - from adafruit_datetime import datetime, date, time, timezone + from adafruit_datetime import datetime, date, time # Using datetime.combine() d = date(2005, 7, 14) @@ -72,7 +72,6 @@ Usage Example # Using datetime.now() print("Current time (GMT +1):", datetime.now()) - print("Current UTC time: ", datetime.now(timezone.utc)) # Using datetime.timetuple() to get tuple of all attributes dt = datetime(2006, 11, 21, 16, 30) @@ -80,12 +79,13 @@ Usage Example for it in tt: print(it) - # Formatting a datetime - print( - "The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.".format( - dt, "day", "month", "time" - ) - ) + print("Today is: ", dt.ctime()) + + iso_date_string = "2020-04-05T05:04:45.752301" + print("Creating new datetime from ISO Date:", iso_date_string) + isodate = datetime.fromisoformat(iso_date_string) + print("Formatted back out as ISO Date: ", isodate.isoformat()) + Documentation =============