From: Tyler Peppy <61562476+T-622@users.noreply.github.com> Date: Sat, 6 Mar 2021 20:31:30 +0000 (-0500) Subject: Merge pull request #4 from janosrusiczki/patch-1 X-Git-Url: https://vault307.fbx.one/gitweb/RPI-PICO-I2C-LCD.git/commitdiff_plain/716235798a1c57b83841bb23b17a15bee7ffe8cc?hp=990c4d52c4fb2d312d425ba15c88012533034e1a Merge pull request #4 from janosrusiczki/patch-1 Better date / time formatting --- diff --git a/pico_i2c_lcd_test.py b/pico_i2c_lcd_test.py index 89e2d96..34fd9ff 100644 --- a/pico_i2c_lcd_test.py +++ b/pico_i2c_lcd_test.py @@ -21,9 +21,9 @@ def test_main(): while True: lcd.clear() time = utime.localtime() - lcd.putstr("{year}/{month}/{day} {HH}:{MM}:{SS}".format( - year=str(time[0]), month=str(time[1]), day=str(time[2]), - HH=str(time[3]), MM=str(time[4]), SS=str(time[5]))) + lcd.putstr("{year:>04d}/{month:>02d}/{day:>02d} {HH:>02d}:{MM:>02d}:{SS:>02d}".format( + year=time[0], month=time[1], day=time[2], + HH=time[3], MM=time[4], SS=time[5])) if count % 10 == 0: print("Turning cursor on") lcd.show_cursor()