Merge pull request #13 from Neradoc/patch-1
Fix example from the readme for Circuitpython
This commit is contained in:
commit
e9ae7cd782
1 changed files with 8 additions and 8 deletions
16
README.rst
16
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
|
||||
=============
|
||||
|
|
|
|||
Loading…
Reference in a new issue