|
-
Mar 31st, 2004, 01:19 AM
#1
Thread Starter
Junior Member
Date Problems
HI
i am using the Date Time Control Picker
i have set the format as being short
and i have two set of dates , i wish to find the number of weeks between the two set of dates ?? how do i do that
for eg ?
date 1 : 01/04/2004
date 2 : 22/04/2004
i should get a result of 3 weeks
How do i go about to do that ?
can anyone help me plz ?
-
Mar 31st, 2004, 03:11 AM
#2
Sleep mode
Here is an example , I knocked up .
VB Code:
Private Sub test()
Dim StartDate As New Date(2004, 4, 1)
Dim EndDate As New Date(2004, 4, 22)
Dim span As TimeSpan = EndDate.Subtract(StartDate)
StartDate.Subtract(StartDate)
Dim NumberOfDays As Integer = span.Days
Select Case NumberOfDays
Case 0 To 7
MessageBox.Show("One week ago")
Case 7 To 15
MessageBox.Show("Two weeks ago")
Case 15 To 23
MessageBox.Show("Three weeks ago")
Case 23 To 30
MessageBox.Show("Four weeks ago")
End Select
End Sub
-
Mar 31st, 2004, 08:40 AM
#3
Frenzied Member
or, look into the DateDiff Function
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
|