Current date and Date user variables
Posted: Monday 10 December 2018 22:41
Hi,
I want to do a simple thing : test if the current date matches the value of a user variable of "Date" type.
returns a string that looks like : "25/12/2018"
but: returns a string that looks like : "2018-12-25"
So I cannot compare the two. Also:
Does not work since the trigger rules cannot have a dd/mm/yyyy format, only dd/mm
As a workaround I now rely on:
That's quite cumbersome for a simple task, and this is awfully non robust as it will break if the date format changes.
Is there any good solution?
Thanks!
I want to do a simple thing : test if the current date matches the value of a user variable of "Date" type.
Code: Select all
domoticz.variables("MyDate").value
but:
Code: Select all
domoticz.time.rawDate
So I cannot compare the two. Also:
Code: Select all
domoticz.time.matchesRule('on '.. domoticz.variables("MyDate").value)
As a workaround I now rely on:
Code: Select all
local day = domoticz.time.day
local month = domoticz.time.month
local year = domoticz.time.year
local date = day .. '/' .. month .. '/' .. year
if date==domoticz.variables(MyDate').value then
Is there any good solution?
Thanks!