UIFlow Guide
Read the current time through the network server, Note: When the program download offline, you need to add WiFi connection program before NTP initialization program, so that the device connects to the network.
from m5stack import *
from m5ui import *
from uiflow import *
import ntptime
import time
setScreenColor(0x222222)
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8)
while True:
print(ntp.formatDatetime('-', ':'))
print(ntp.getTimestamp())
wait(1)
wait_ms(2)
import ntptime
ntp = ntptime.client(host='cn.pool.ntp.org', timezone=8)
cn.pool.ntp.org
jp.pool.ntp.org
sg.pool.ntp.org
tw.pool.ntp.org
hk.pool.ntp.org
us.pool.ntp.org
de.pool.ntp.org
ntp.formatDate('-')
ntp.formatTime(':')
ntp.formatDatetime('-', ':')
ntp.getTimestamp()
ntp.year()
ntp.month()
ntp.weekday()
ntp.day()
ntp.hour()
ntp.minute()
ntp.second()