Another dumb Lua/Luup question - sorry!

I need to check the day in some scene Lua/Luup code but the following does not appear to work, it always returns false on the day specified. Can anyone help?

local tday = ("%A"))
if (tday == "Wednesday") then
return true
return false

The %A format is locale dependent. Not sure if that’s an issue or not. I’d probably go with *t and get the day number from the table returned. Table contains year , month (1–12), day (1–31), hour (0–23), min (0–59), sec (0–61), wday (weekday, 1–7, Sunday is 1), yday (day of the year, 1–366), and isdst (daylight saving flag, a boolean)

Anticipating the question:

return"*t")["wday"] == 4 

This returns true on Wednesday, false otherwise.


Thanks guys. What would I do without you. :smile:

1 Like

Best Home Automation shopping experience. Shop at getvera!

Β© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy