LogicMachine Forum
Data/time question - Printable Version

+- LogicMachine 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: Data/time question (/showthread.php?tid=6473)



Data/time question - mrKayne - 16.06.2026

Hi, 

I'm having an issue with getting datetime. I used a script from the Logicmachine site:

Code:
-- get current date as table now = os.date('*t') -- write to bus grp.write('0/0/2', now, dt.date) grp.write('0/0/1', now, dt.time) -- system week day starts from sunday, convert it to knx format wday = now.wday == 1 and 7 or now.wday - 1 --- full date bits OCT08 = now.year - 1900 OCT07 = now.month OCT06 = now.day OCT05 = bit.bor(bit.lshift(wday, 5), now.hour) OCT04 = now.min OCT03 = now.sec OCT02 = 0 -- subfields like working day and dst not specified in this sample OCT01 = 0 -- subfields like quality of clock not specified in this sample -- write to bus date_time = string.char(OCT08, OCT07, OCT06, OCT05, OCT04, OCT03, OCT02, OCT01) grp.write('0/0/3', date_time)

Date and time works (0/0/2 and 0/0/1) but 0/0/3 gives no output.

What am I doing wrong? Smile


RE: Data/time question - admin - 16.06.2026

This data type is not supported in LM.
Use raw datatype in the script:
Code:
grp.write('0/0/3', date_time, dt.raw)



RE: Data/time question - mrKayne - 16.06.2026

(Yesterday, 06:28)admin Wrote: This data type is not supported in LM.
Use raw datatype in the script:
Code:
grp.write('0/0/3', date_time, dt.raw)

Thanks! Worked like a charm.