Logic Machine Forum
grp.chackwrite in date/time object - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: grp.chackwrite in date/time object (/showthread.php?tid=3499)



grp.chackwrite in date/time object - emme - 02.08.2021

Code:
d = os.date('*t')
grp.checkwrite('objDate', d)
grp.checkwrite('objTime', d)
d= nil

is checkwrite compatible with date and time objects?
'cause I'm struggling on a script whitch wont update time when it changes....


RE: grp.chackwrite in date/time object - Daniel - 02.08.2021

Date and time are not in this format. Try this.
Code:
-- get current data as table
now = os.date('*t')
-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1
-- time table
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}
-- date table
date = {
day = now.day,
month = now.month,
year = now.year,
}
-- write to bus
grp.checkwrite('1/1/2', time, dt.time)
grp.checkwrite('1/1/1', date, dt.date)



RE: grp.chackwrite in date/time object - emme - 02.08.2021

(02.08.2021, 09:52)Daniel. Wrote: Date and time are not in this format. Try this.
Code:
-- get current data as table
now = os.date('*t')
-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1
-- time table
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}
-- date table
date = {
day = now.day,
month = now.month,
year = now.year,
}
-- write to bus
grp.checkwrite('1/1/2', time, dt.time)
grp.checkwrite('1/1/1', date, dt.date)

uh, that's why date works, but time not! Big Grin
thanks