IT. Expert System.

VBS

DateAdd()


Description

The DateAdd() function returns a date to which a specified time interval has been added.

This function has the form:

DateAdd(interval,number,date)
Parameter Description
interval (required) The interval you want to add. Can take the following values:
  • yyyy - Year
  • q - Quarter
  • m - Month
  • y - Day of year
  • d - Day
  • w - Weekday
  • ww - Week of year
  • h - Hour
  • n - Minute
  • s - Second
number (required) The number of interval you want to add. Can either be positive, for dates in the future, or negative, for dates in the past
date (required) Variant or literal representing the date to which interval is added

Examples

The following examples show the basic use of this function:

Example 1

How to use the parameters:

Msgbox(DateAdd("yyyy",1,"31-Jan-10"))
Msgbox(DateAdd("q",1,"31-Jan-10"))
Msgbox(DateAdd("m",1,"31-Jan-10"))
Msgbox(DateAdd("y",1,"31-Jan-10"))
Msgbox(DateAdd("d",1,"31-Jan-10"))
Msgbox(DateAdd("w",1,"31-Jan-10"))
Msgbox(DateAdd("ww",1,"31-Jan-10"))
Msgbox(DateAdd("h",1,"31-Jan-10 08:50:00"))
Msgbox(DateAdd("n",1,"31-Jan-10 08:50:00"))
Msgbox(DateAdd("s",1,"31-Jan-10 08:50:00")

This produces the following result (each line in a separate pop-up message box):

1/31/2011
4/30/2010
2/28/2010
2/1/2010
2/1/2010
2/1/2010
2/7/2010
1/31/2010 9:50:00 AM
1/31/2010 8:51:00 AM
1/31/2010 8:50:01 AM

Example 2

Subtract one month from January 31, 2010

Msgbox(DateAdd("m",-1,"31-Jan-10"))

This produces the following result:

12/31/2009

Example 3

Add one day from now:

Msgbox(DateAdd("d",1,Now()))

Miscellaneous Information

Supported in Version: 2.0


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3566 / . Delta: 0.02284 с