|
-
February 21st, 2000, 09:12 AM
#1
Date Functions
I am assigning the current date to a text box, however, I want to always subtract three days if the day falls on a "Monday". I have the days of the week all worked out, but I can't seem to subtract the amount of days that I need.
If (ResultDate = "Monday") then
MyTextBox.Text = Today - 3
End If
Of course the above does not work, but that is the basic problem I am having. If anyone has an idea please let me know.
Thanks
-
February 21st, 2000, 09:18 AM
#2
Re: Date Functions
mytextbox.text = DateAdd("d", Now, -3)
-
February 21st, 2000, 09:43 AM
#3
Re: Date Functions
The function should actually be
Mydate = Format$(DateAdd("d", -3, Now), "dddd")
you can use format$ to format a date anyway you like check te help files.
-
February 21st, 2000, 10:07 AM
#4
Re: Date Functions
The WeekDay Function returns an integer representing the day of week referenced by a date.
dtMyDate = CDate(text1.Text) 'get date From Text Box
iDayOfWeek = WeekDay(dtMyDate) 'Ask for the day of week
If iDayOfWeek = 2 then 'If it's Monday
dtMyDate = dtMyDate - 3 'Subtract 3 days
text1.Text = Format(dtMyDate, "MM/DD/YYYY")
End If
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
|