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

x
?
Solved

Return date as lastyear date

Posted on 2014-12-31
4
Medium Priority
?
181 Views
Last Modified: 2014-12-31
How can I get last year from today?

This returns = 12/31/204. I also want it to return 12/31/2013.
 Dim current_targetDate As Date = Today
 result = 12/31/2014

 Dim previous_targetDate As Date = Today  ?
 result = 12/31/2013
0
Comment
Question by:VBdotnet2005
[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
  • 2
4 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 40525852
This should give you what you need.

Dim current_targetDate As DateTime = DateTime.Today
Dim previous_targetDate As DateTime = DateTime.Today.AddYears(-1) 

Open in new window

0
 
LVL 79

Expert Comment

by:arnold
ID: 40525857
you need to clarify whether you want the date on the last Wednesday in December 2013, or do you want the Day on which 12/31/2013 fell.  Those are not the same.

12/31/2013 was a Tuesday .
Today in 2013 was 12/25/2013

If you only care about the date, there are date math function where you can use date and subtract a year.
0
 

Author Closing Comment

by:VBdotnet2005
ID: 40525858
Thank you Fernando
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40525862
Not a problem VBdotnet2005, glad I was able ti help.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…

722 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