Solved

DateTime Function (Easy Point)

Posted on 2007-04-11
5
151 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:jsctechy
  • 4
5 Comments
 
LVL 1

Author Comment

by:jsctechy
ID: 18891002
something like this:
DateTime.Today.AddDays(180)

but i need older not in the future!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18891003
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
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18891011
Oh! .Net...
just use negative...
DateTime.Today.AddDays(-180)

to get 180 days 'ago'...
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18891040
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
 
LVL 67

Expert Comment

by:sirbounty
ID: 18891329
Thanx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question