Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DateTime Function (Easy Point)

Posted on 2007-04-11
5
Medium Priority
?
155 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

705 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