Date Subtract ?

I now this is a really stupid question but I just can’t work out how to do it. I need to get the current date / time and subtract 7 days from it.

dim d as new date d.day = d.day - 7

Thank you so much, now I see how to do it, it is just so simple, I should have realised that. Thanks again for the quick reply :wink:

Using Xojo.Core.Date:

Dim interval As New Xojo.Core.DateInterval interval.Days = 7 Dim lastWeek As Xojo.Core.Date = Xojo.Core.Date.Now - interval

[quote=308252:@Paul Lefebvre]Using Xojo.Core.Date:

Dim interval As New Xojo.Core.DateInterval interval.Days = 7 Dim lastWeek As Xojo.Core.Date = Xojo.Core.Date.Now - interval[/quote]
Thanks Paul. Could you tell me, should I now be using Xojo.Core rather than the old way of doing things as I learnt Xojo before all these new .Core things appeared?

I’d say it’s good to be aware of the new Xojo namespace classes so you can know when it might be appropriate to use them. The classic Date class is not going anywhere, but Xojo.Core.Date, along with DateInterval and TimeZone, allow for more accurate date management and manipulation.