|
-
Jan 23rd, 2002, 05:12 AM
#1
Subtract months from Date data type
I am using the Date data type and am using the following code:
'Calculate delete date
Select Case RetainUnit
Case "Days"
dtmDeleteDate = Now() - RetainNumber
Case "Weeks"
dtmDeleteDate = Now() - (RetainNumber * 7)
Case "Months"
'dtmDeleteDate = Now() - ??????
End Select
The only thing is that the Date data type only seems to lend itself to maths involving whole days (integers) or hours (fractions - ie 1/24 = 1 hour).
My question is, how can I subtract 1 month. And I don't want to subtract 30 days or whatever. So if I've got 21/05/02, then subtracting 1 month would give 21/04/02. And it works regardless of days in the month (28/29/30/31).
Is there another data type that I should be using; or a function that I've yet to discover??
Thanks in anticipation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|