Incrementing dates (using a Clock in a loop)

Hello everyone, I'm trying to make a routine where an event is repeated every "x" hours (tbHsRepite) for "y" days (tbDiasARepetir) from a date taken from a datepicker. For now, I would like to display the results on a label. Since a repeat can fall on one date and the next, the next day, I would like to be able to increment the date. I suppose that that can be achieved with the clock, but frankly, I don't know how to implement it. If someone could help me, I would be grateful.

Simple answer is,

Set the clock interval to 10006060= 3600000 also enable the clock to timer.
(Clock will trigger for every 1hr)

When clock timers
Do the task

Sorry, but I cannot follow you. The date has to change while adding hours in the loop. It is not a timing event. But if you have a clear idea on how to do it and can show the blocks I will appreciate it.

Add hours using the Clock. After you do this you may need to update the date.

Posting your Blocks in English might allow someone to help you. Make it easier for the non Spanish speaking majority on the forum. :astonished:

Clock

Show what you tried using the Clock.

Thank you SteveJG. I will read what you sent and I will translate the name of the variables in english. I will then try to see how can I manage the clock for myself. In either way I will be back.

As I understood the Add of the clock adds a day as I was hopping. But, now I received an error message: I tried another format of the day and got the same error.

image

Your global variable "day" needs to be a time instant, e.g. from Clock1.Now

Yes, I just discovered it but the result is a long text of things (starting with java.util.gregorian.....year, month, day, time, etc). Now I need to find how to isolate day, month and year.

I found how. In a minute I will post the answer

Now it shows me only the year but I think that the answer is around. Thank you Steve and Tim for your help

Taifun

I switched all the ways but it shows me the last I declared with the format xxxx- -- hour:minute
Where xxxxx is the day, the month or the year but just the last I declared. I will try again and let you know

You were absolutely right. My mistake Thank you Taifun