11.01.2024, 21:50
Hi,
you can try as Domotiqa recommended. Possible variant - show your data with zeroes, when you need enter data - zero is not so important may be.
Long time ago I did something you need with hour and minutes less 10, I wanted zero in front:
Simple but works. In result I see time with zeroes in front and weekdays text in required language. This is just like an idea. And of course you need take in mind data types and convert it if needed..
BR,
Alex
you can try as Domotiqa recommended. Possible variant - show your data with zeroes, when you need enter data - zero is not so important may be.
Long time ago I did something you need with hour and minutes less 10, I wanted zero in front:
Code:
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}
h1 = now.hour
m1 = now.min
ms = now.month
weekday1 = wday
if now.hour == 0 then h1 = "00"
end
if now.hour == 1 then h1 = "01"
end
if now.hour == 2 then h1 = "02"
end
if now.hour == 3 then h1 = "03"
end
if now.hour == 4 then h1 = "04"
end
if now.hour == 5 then h1 = "05"
end
if now.hour == 6 then h1 = "06"
end
if now.hour == 7 then h1 = "07"
end
if now.hour == 8 then h1 = "08"
end
if now.hour == 9 then h1 = "09"
end
if now.min == 0 then m1 = "00"
end
if now.min == 1 then m1 = "01"
end
if now.min == 2 then m1 = "02"
end
if now.min == 3 then m1 = "03"
end
if now.min == 4 then m1 = "04"
end
if now.min == 5 then m1 = "05"
end
if now.min == 6 then m1 = "06"
end
if now.min == 7 then m1 = "07"
end
if now.min == 8 then m1 = "08"
end
if now.min == 9 then m1 = "09"
end
if now.hour == 0 then h1 = "00"
end
if weekday1 == 1 then weekdayru = "Понедельник"
end
if weekday1 == 2 then weekdayru = "Вторник"
end
if weekday1 == 3 then weekdayru = "Среда"
end
if weekday1 == 4 then weekdayru = "Четверг"
end
if weekday1 == 5 then weekdayru = "Пятница"
end
if weekday1 == 6 then weekdayru = "Суббота"
end
if weekday1 == 7 then weekdayru = "Воскресенье"
end
Simple but works. In result I see time with zeroes in front and weekdays text in required language. This is just like an idea. And of course you need take in mind data types and convert it if needed..
BR,
Alex