Date of tomorrow  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Date of tomorrow

Post 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.
bramski
Posts: 45
Joined: Thursday 20 July 2017 16:26
Target OS: -
Domoticz version:
Contact:

Re: Date of tomorrow

Post 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)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Date of tomorrow

Post 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)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Date of tomorrow

Post by ronaldbro »

Thx waaren, I will try this
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Date of tomorrow  [Solved]

Post by ronaldbro »

Finally had the time to test this and it works great. Thanks Waaren
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests