Skip to content

Commit e9ae7cd

Browse files
authored
Merge pull request #13 from Neradoc/patch-1
Fix example from the readme for Circuitpython
2 parents 360bfb3 + 42c02c8 commit e9ae7cd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Usage Example
6262
6363
# Example of working with a `datetime` object
6464
# from https://docs.python.org/3/library/datetime.html#examples-of-usage-datetime
65-
from adafruit_datetime import datetime, date, time, timezone
65+
from adafruit_datetime import datetime, date, time
6666
6767
# Using datetime.combine()
6868
d = date(2005, 7, 14)
@@ -72,20 +72,20 @@ Usage Example
7272
7373
# Using datetime.now()
7474
print("Current time (GMT +1):", datetime.now())
75-
print("Current UTC time: ", datetime.now(timezone.utc))
7675
7776
# Using datetime.timetuple() to get tuple of all attributes
7877
dt = datetime(2006, 11, 21, 16, 30)
7978
tt = dt.timetuple()
8079
for it in tt:
8180
print(it)
8281
83-
# Formatting a datetime
84-
print(
85-
"The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.".format(
86-
dt, "day", "month", "time"
87-
)
88-
)
82+
print("Today is: ", dt.ctime())
83+
84+
iso_date_string = "2020-04-05T05:04:45.752301"
85+
print("Creating new datetime from ISO Date:", iso_date_string)
86+
isodate = datetime.fromisoformat(iso_date_string)
87+
print("Formatted back out as ISO Date: ", isodate.isoformat())
88+
8989
9090
Documentation
9191
=============

0 commit comments

Comments
 (0)