Add a week to a date

I have a start date and I want to add a week to it (in a loop).

The loop, etc. are already there, but I do not understand how to add an interval (of 7 days) to that already existing date.

TIA

MyDate.Day = MyDate.Day + 7 // was so easy !

Use DateInterval – set it to 7 days and then add:

Var interval As New DateInterval(0,0,7)
myDate = myDate + interval

You can also use mydate = mydate.AddInterval(0, 0, 7)

2 Likes

Thank you folks !

It was easier using old stuff… and the docs does not helped.

I used:

Var aWeek As New DateInterval(0,0,7)
Date_Start = Date_Start + aWeek

It compiles… (I have more lines to add…)

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.