Add 3 years to a date : Date « Date Time « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial » Date Time » Date 
5. 1. 7. Add 3 years to a date
 
 

public class Test
   public Shared Sub Main

        Dim Expiration As Date
        Dim NewExpiration As Date

        Expiration = #1/1/2005#
        Expiration.AddYears(3)
        NewExpiration = Expiration.AddYears(3)
        Console.WriteLine("The new expiration date is: " & NewExpiration)

   End Sub
End class

        
  
  




The new expiration date is: 01/01/2008

 
5. 1. Date
5. 1. 1. Dim thirdOfJuly As Date = #7/3/1776 11:59:59 PM#
5. 1. 2. Dim fourthOfJuly As New Date(1776, 7, 4)
5. 1. 3. Dim inTheMorning As New Date(1776, 7, 4, 9, 45, 30)
5. 1. 4. dateVariable = #1/1/2004#
5. 1. 5. dateVariable = #8/27/2001 6:29:11 PM#
5. 1. 6. dateVariable = 'July 2, 2002'
5. 1. 7. Add 3 years to a date
5. 1. 8. Date AddYears, AddMonths and AddDays
5. 1. 9. Add Time to current time
5. 1. 10. Elapsed Ticks
5. 1. 11. Subtract Time
5. 1. 12. Date ToString, ToLongDateString, ToShortDateString, ToLongTimeString, ToShortTimeString and ToUniversalTime
5. 1. 13. System Time
5. 1. 14. Moon Phase
5. 1. 15. Parse Date: Test an invalid date
5. 1. 16. Date and TimeSpan
5. 1. 17. ToLongDateString
5. 1. 18. ToLongTimeString
5. 1. 19. Date.ToOADate
5. 1. 20. Get Ticks from DateTime
5. 1. 21. Compare Date value in If statement
5. 1. 22. Select Day Of Week
w___w___w___.j__ava2__s__.__c__o_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.