How to get the differences within a range of dates
Posted on 2006-06-02
Hey whats up experts. I have a simple question I want to know how to subtract or use the DateDiff function to get a particular value from anydate.
Example let say If the user chooses from a datetime picker May 26, 2006 . I want to know how can i compare the system date to the actual date
that the user has chosen and give me how many days apart is it from each other.
So if the user takes May 26 and today is June 2
I want to be able to display the differences in days on another text box which in this case would be " 7" if you minus today date with the one that was chosen.
Well I try to do this on my own and I know I'm a bit close to it but my futile attempts have gone no where lol
Here is a sample code
Dim StorePDate As Date
StorePDate = PurchaseDate.Value 'picked by the User '
StoreDate(StorePDate) 'Sends the value to a method
Public Sub StoreDate(ByVal PurchaseD)
PurchaseD = CInt(DateDiff(DateInterval.Day - ????? )) '''Here I try to use System.DateTime...but it gives me an error
txtDaysIN.Text = PurchaseD
So if anyone can please help me with this little issue I would gladly appreciate it..also please let me know where did I go wrong..or was I close at all lol.
Take care experts ^_^