Replies: 4 comments 1 reply
-
MicroPython does not support timezones. It is usual to set the clock on a microcontroller to local time. In a location with DST, a typical long running application will run winter time. If it is required to display local time the application performs the conversion for summer time. |
Beta Was this translation helpful? Give feedback.
-
i made my own way to do this and dst https://github.com/GM-Script-Writer-62850/PICO_W_Thermostat/blob/main/PICO/main.py |
Beta Was this translation helpful? Give feedback.
-
It is convention that computers store universal time (i.e. UTC/GMT) in the hardware clock. When the time gets displayed you either display that UTC time, or if you want to display local time (i.e. time offset by your local timezone), then you need a timezone offset which you will have to configure in your system/app. I use the standard MicroPython datetime library which includes a |
Beta Was this translation helpful? Give feedback.
-
If you're using a board like the ESP8266 or ESP32 with internet access, you can use ntptime to get the current UTC time from an NTP server and then adjust it for your timezone. |
Beta Was this translation helpful? Give feedback.
-
Can I use timezone in MicroPython, how to set the offset?
Is it use
RTC.init()
tzinfo
argument? it's not describe in document.Beta Was this translation helpful? Give feedback.
All reactions