DateAdd returns the result of adding or subtracting a specified period of time to a date: : DateAdd « Date Functions « VBA / Excel / Access / Word






DateAdd returns the result of adding or subtracting a specified period of time to a date:

 
Sub DateAddExample()
    Debug.Print DateAdd("d", 3, Now)
    'Today plus 3 days
    Debug.Print DateAdd("m", 3, Now)
    'Today plus 3 months
    Debug.Print DateAdd("yyyy", 3, Now)
    'Today plus 3 years
    Debug.Print DateAdd("q", 3, Now)
    'Today plus 3 quarters
    Debug.Print DateAdd("ww", 3, Now)
    'Today plus 3 weeks
    Debug.Print DateAdd("ww", -3, Now)
    'Today minus 3 weeks
End Sub

 








Related examples in the same category

1.Add value to Date
2.DateAdd(interval, number, date) returns a Variant/Date containing the date of the specified interval after the specified date