Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i have two datetimepicker.

dtp1 and dtp2

want condition true
dtp1 = 1-1-2011
dtp2 = 4-1-2011


if dtp2's value is between 1-1-2011 to 7-1-2011 (7 days ahead from dtp1's date) then condition true.


if
dtp1 = 1-1-2011
dtp2 = 9-1-2011
then condition false
Posted

VB
Dim ts As TimeSpan 
Dim condition As Boolean 
ts = dtp1.Value.Subtract(dtp2)
if ts.Days >= 7 Then Condition =True
 
Share this answer
 
v2
Comments
Wayne Gaylard 12-Nov-11 1:17am    
That's it +5 (just put code in code blocks)
RaviRanjanKr 13-Nov-11 2:10am    
My 5+
Use the TimeSpan class to calculate the differences between the two dates.
Go through this[^] for an example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900