MicroPython Time Display
Posted: Wed Apr 07, 2021 12:17 pm
Hello everyone,
Newbie to Micropython so apologies if this post is in the wrong place, please feel free to tell me off!
I'm just beginning to build a weather monitor using a Pico (yes another weather station) but it's cheaper than putting a fully fledged Pi outside.
I have 'borrowed' code to read from a BME280 module and can get it to display Temperature, Pressure and Humidity just using a Pintout at the moment, with plans to send the data to a remote display.
I'd like to print the Date and Time and can get this to happen using the built in RTC and
What I can't seem to fathom in micropython is how to format this to give a more human readable display, it gives me:
(2021, 4, 7, 12, 49, 6, 2, 97)
Which is Year, Month, Day, Hour, Min, Sec & Millisec.
I just want this to display UK style date and time like 07/04/2021 12:49
Have tried various Python formatting to no avail.
Can anyone give me a link to how to better format it in micropython?
Many thanks.
Newbie to Micropython so apologies if this post is in the wrong place, please feel free to tell me off!
I'm just beginning to build a weather monitor using a Pico (yes another weather station) but it's cheaper than putting a fully fledged Pi outside.
I have 'borrowed' code to read from a BME280 module and can get it to display Temperature, Pressure and Humidity just using a Pintout at the moment, with plans to send the data to a remote display.
I'd like to print the Date and Time and can get this to happen using the built in RTC and
Code: Select all
print(utime.localtime())
(2021, 4, 7, 12, 49, 6, 2, 97)
Which is Year, Month, Day, Hour, Min, Sec & Millisec.
I just want this to display UK style date and time like 07/04/2021 12:49
Have tried various Python formatting to no avail.
Can anyone give me a link to how to better format it in micropython?
Many thanks.