I'm trying to do some simple date arithmetic in B4A but the logic of this defeats me, even with DateUtils loaded. All I want to do is subtract a given number of days from the current date and return the new date as a string.
I know I can get the current date using DateTime.Now and extract parts of it with DateTime.GetDayOfMonth(OurDate). I can see that Periods and SetDateAndTime might be able to do what I want but, without an example, I can't figure out the code for this.
Evidently I can't use a statement like OurStartDate = DateTime.Subtract(DateTime.Now, 375) because DateTime.Subtract is in Java but not B4A...?
I've searched on line because I thought the answer to this would be on line, but I can't find it. Maybe it's so simple that no-one else has asked, and I'm just dim. Is there a simple way to do this?
Thanks.
I know I can get the current date using DateTime.Now and extract parts of it with DateTime.GetDayOfMonth(OurDate). I can see that Periods and SetDateAndTime might be able to do what I want but, without an example, I can't figure out the code for this.
Evidently I can't use a statement like OurStartDate = DateTime.Subtract(DateTime.Now, 375) because DateTime.Subtract is in Java but not B4A...?
I've searched on line because I thought the answer to this would be on line, but I can't find it. Maybe it's so simple that no-one else has asked, and I'm just dim. Is there a simple way to do this?
Thanks.