The DateAdd function in VBA adds a time interval to a supplied date and/or time and returns the resultant date/time.

Syntax

Parameter

Interval (required) – This parameter a string specifying the interval to be used.

It can take the following values:

  • “d” – Days
  • “h” – Hours
  • “n” – Minutes
  • “m” – Months
  • “q” – Quarters
  • “s” – Seconds
  • “ww” – Weeks
  • “yyyy” – Years

Number (required) – This parameter represents the number of intervals to add to the specified Date.

Date (required) – This parameter represents the date/time that you want to add the specified number of intervals to.

Return

This function returns the resultant date/time.

Example 1

Output

4/25/2020

VBA DateAdd Function

Example 2

Output

11/29/2020 12:40

VBA DateAdd Function

Example 3

Output

1/29/2021 0:00

VBA DateAdd Function

Pin It on Pinterest

Share This