0

I have a raspberry pi pico and a DS3231 real time clock hooked up to it. I'm able to receive the current time in BCD and format it in a string by Hours:Minutes:seconds "00:00:00" using the DS3231 sample code that has been provided from the waveshare wiki waveshare wiki

I've tried using a datetime module but I get the error "no module named datetime" so I'm unsure if it's included within micropython.

this was my attempt

def elapsed_time(self, start, end):
    start_time = datetime.strptime(start,"%H:%M:%S")
    end_time = datetime.strptime(end,"%H:%M:%S")
    
    return end_time - start_time

1 Answers1

0

You can find datetime in the micropython-lib repository, a collection of curated (by the MicroPython core team) libraries useful when developing MicroPython applications.

For now, the easiest way to use datetime is to copy datetime.py to your device and ensure it can be found in your sys.path.

MattyT
  • 6,531
  • 2
  • 20
  • 17