Link to home
Start Free TrialLog in
Avatar of jsctechy
jsctechyFlag for United States of America

asked on

DateTime Function (Easy Point)

hi there,
I have a function that is suposed to let me know when the date is 180 dyas older than todays date for instance if the date is September --, 2006 and i run my fucntion today i will let me know if this is true.

I know it has to do with the DateTime function and the add days but i dont remenber how to do it can you guys help me?
Thanks
Avatar of jsctechy
jsctechy
Flag of United States of America image

ASKER

something like this:
DateTime.Today.AddDays(180)

but i need older not in the future!
Avatar of sirbounty
Hello jsctechy,

Something like:

myDate=dateadd("d",-180,date)
'myDate=10/13/2006
 
If  datediff("d",myDate,date)= 180 Then msgbox "180 days since..." & myDate




~sirbounty
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure how you're using your function, but something like this?

Dim myDate As Date=Date.Today.AddDays(-180) 'would get 180 days ago...


Or

If oldDate.AddDays(180)=Date.Today Then
 'oldDate is equal to '180 days ago'
Thanx