Solved

DateTime Function (Easy Point)

Posted on 2007-04-11
5
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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