VBS tutorial: function – DateAdd function

Time:2021-9-19

DateAdd function

Returns the date to which the specified time interval has been added.

DateAdd(interval, number, date)

parameter

interval

Required. A string expression representing the time interval to add. For values, see the settings section.

number

Required. A numeric expression representing the number of time intervals to add. Numeric expressions can be positive (get future dates) or negative (get past dates).

date

Required.VariantOr to addintervalThe text representing the date.

set up

intervalParameters can have the following values:

set up describe
yyyy year
q quarter
m month
y Days of the year
d day
w Days of the week
ww week
h hour
n minute
s second

explain

availableDateAddFunction adds or subtracts a specified time interval from a date. For example, you can useDateAddA date 30 days from that day or 45 minutes from now. TodateTo add a time interval in days, you can use days of the year (“Y”), days of the week (“d”), or days of the week (“W”).

DateAddThe function does not return an invalid date. The following example adds one month to January 31, 1995:

NewDate = DateAdd("m", 1, "31-Jan-95")

In this example,DateAddReturn to February 28, 1995 instead of February 31, 1995. IfdateIf it is January 31, 1996, it returns February 29, 1996, because 1996 is a leap year.

If the calculated date is before A.D. 100, an error will occur.

IfnumbernoLongType value, rounded to the nearest integer before calculation.

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]