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
LVL 1
jsctechyAsked:
Who is Participating?
 
sirbountyConnect With a Mentor Commented:
Oh! .Net...
just use negative...
DateTime.Today.AddDays(-180)

to get 180 days 'ago'...
0
 
jsctechyAuthor Commented:
something like this:
DateTime.Today.AddDays(180)

but i need older not in the future!
0
 
sirbountyCommented:
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
0
 
sirbountyCommented:
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'
0
 
sirbountyCommented:
Thanx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.