Figuring out the day of the week with Luup code


I’m trying to figure out how to determine the day of the week with Luup code (I have an event that fires on week days but I don’t want it to fire at the weekend so the only way I can see to do it is with code, there are no check boxes with an event), can anyone help with this please?

Thanks in advance for your help,



[url=]Lua 5.1 Reference Manual

Thanks but still can’f figure out how to extract the day of week out of this. I understand wday is part of a table, I just can’t figure out how to get it out of the table.

Thanks agian for any help. I’m a total newbie as you can tell.


local t = ("*t")
local weekdays = {
luup.log ("Today is day " .. t.wday .. " of the week, which means " .. weekdays[t.wday])

The code above will print:

Today is day 5 of the week, which means Thursday

Thanks much. I was just reading all about tables and had figured out:

– Check to see if it’s the weekend
local dy =“*t”)
local day_of_week = dy.wday
if (day_of_week == 1) or (day_of_week == 7) then
return false

But didn’t know how to assign a name to them so that is helpful.

Thanks again,


print("%A", os.time()))