[Gambas-user] Using Date datatype for FOR-NEXT

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Jun 18 08:16:43 CEST 2007


Hi Ron,

Thanks a lot for that explanation.

> FOR i = CINT(startdate) TO CINT(enddate) step CINT( (DAY(Now)+1)-DAY(Now) )
> The step value calculate to the integer value need for 1 day.

Actually, I tried this but without the Step thing - so it failed.

> A more appropriate way will be something like next.
>   DIM i AS Date
>   i=startdate
>   DO
>     'your code what must be done with i
>     ...
>     i=i+1 ' same as DATE(Now)+1
>   LOOP UNTIL i=enddate ' or enddate+1

Yep, this is what instantly springs to my mind, too.

Meanwhile I built my own function with a lot of counting, increasing,
decreasing and IFs and stuff. Maybe I'll try and replace it by this
simpler way.

> 
> Hope this explains something.

Oh yes, thank you very much again :-)

Rolf





More information about the User mailing list