Date subtraction

I use block like photo.

Use the +1 mathematical formula before because I found a problem.

If you subtract the same date from the same date, the remaining date is 0.

Using tomorrow's date minus today's date results in the same 0.

How do I getting fix them.

to add or subtract days, use the AddDays method from the clock component


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I think I see the problem here.

The Instant returned by the Date Picker is the Instant the day starts.
That would make the Duration in milliseconds from Now() to the start of today always a negative number, except if you set the DatePicker exactly at midnight and run this code.

That's why you had to add +1.

I'm sorry, I still don't understand the solution.

this works for me


@ABG is right.


1 Day = 24 hours
So, if some time of the day has already passed then the time till Midnight will be less than 24 hours and because 24 hours have not completed, the number of days stays 0.
To fix this you should add the current time to the day.

Here is a procedure to give you just the Today part of Clock1.Now, to make date subtraction come out cleanly ...

Capture clock.aia (2.1 KB) Designer Tomorrow

The Today() procedure and the Date Picker event block can be dragged directly into your Blocks Editor.