Page 1 of 1

Date of tomorrow

Posted: Sunday 22 December 2019 21:47
by ronaldbro
How can I get a Time object with the date of tomorrow?

Something like
local tomorrow = domoticz.time.addDay(1)

Thanks for your help.

Re: Date of tomorrow

Posted: Sunday 22 December 2019 22:19
by bramski
I don't think you can.

In the dzVents documentation is stated:
Note: it is currently not possible to change a time object instance.

Maybe you can do something like this in native LUA (untested):

Code: Select all

t = os.date("*t")
t.day = t.day + 1
tomorrow = os.time(t)

Re: Date of tomorrow

Posted: Sunday 22 December 2019 22:44
by waaren
ronaldbro wrote: Sunday 22 December 2019 21:47 How can I get a Time object with the date of tomorrow?
in dzVents you would do

Code: Select all

        local day = 24*3600
        
        local Time = require('Time')
        local newTime = Time( os.date("%Y-%m-%d %H:%M:%S", os.time() + day )) 
        dz.log(newTime.rawDate .. ' ' .. newTime.rawTime,dz.LOG_FORCE)

Re: Date of tomorrow

Posted: Sunday 22 December 2019 23:14
by ronaldbro
Thx waaren, I will try this

Re: Date of tomorrow  [Solved]

Posted: Sunday 29 December 2019 13:59
by ronaldbro
Finally had the time to test this and it works great. Thanks Waaren