adafruit / Adafruit_CircuitPython_datetime

Basic date and time types. Implements a subset of the CPython datetime module.
MIT License
4 stars 9 forks source link

The example in the readme is not compatible with Circuitpython #12

Closed Neradoc closed 3 years ago

Neradoc commented 3 years ago

The example in the readme gets 2 errors in Circuitpython:

print("Current UTC time: ", datetime.now(timezone.utc))
Traceback (most recent call last):
  File "code.py", line 13, in <module>
  File "adafruit_datetime.py", line 1356, in now
  File "adafruit_datetime.py", line 1328, in fromtimestamp
  File "adafruit_datetime.py", line 1306, in _fromtimestamp
NotImplementedError: CircuitPython does not currently implement time.gmtime.
print(
    "The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.".format(
        dt, "day", "month", "time"
    )
)
Traceback (most recent call last):
  File "code.py", line 23, in <module>
ValueError: invalid format specifier

Should it be replaced with the simpletest example code ?

ladyada commented 3 years ago

yes plz!