DateAdd Function

Engade un intervalo de data a unha data especificada un certo número de veces e devolve a data resultante.

Sintaxe:

DateAdd (engadir, conta, data)

Valor de retorno:

Unha variante que conteña unha data.

Parámetros:

Add - A string expression from the following table, specifying the date interval.

Engadir (valor de cadea)

Explicación

aaaa

Ano

q

Trimestre

m

Mes

y

Día do ano

w

Día da semana

ss

Semana do ano

d

Día

h

Hora

n

Minuto

s

Segundo


Count - A numerical expression specifying how often the Add interval will be added (Count is positive) or subtracted (Count is negative).

Date - A given date or the name of a Variant variable containing a date. The Add value will be added Count times to this value.

Exemplo:

Sub example_dateadd

    MsgBox DateAdd("m", 1, "1/31/2004") &" - "& DateAdd("m", 1, "1/31/2005")

End Sub