DateDiff funktsioon

Returns the number of date or time intervals between two given date values.

SĂŒntaks:


DateDiff (interval As String, date1 As Date, date2 As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Double

TagastusvÀÀrtus:

Arv.

Parameetrid:

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

interval (string value)

Selgitus

yyyy

Aasta

q

Kvartal

m

Kuu

y

PĂ€ev aastas

w

NÀdalapÀev

ww

NĂ€dal aastas

d

PĂ€ev

h

Tund

n

Minut

s

Sekund


date1, date2 - The two date values to be compared.

Date literals allow to specify unambiguous date variables that are independent from the current language. Literals are enclosed between hash signs #. Possible formats are:

firstdayofweek: An optional parameter that specifies the starting day of a week.

firstdayofweek value

Selgitus

0

Kasutatakse sĂŒsteemi vaikevÀÀrtust

1

PĂŒhapĂ€ev (vaikimisi)

2

EsmaspÀev

3

TeisipÀev

4

KolmapÀev

5

NeljapÀev

6

Reede

7

LaupÀev


firstweekofyear: An optional parameter that specifies the starting week of a year.

firstweekofyear value

Selgitus

0

Kasutatakse sĂŒsteemi vaikevÀÀrtust

1

NÀdal 1 on nÀdal, mis sisaldab kuupÀeva 1. jaanuar (vaikimisi)

2

NÀdal 1 on nÀdal, mis sisaldab aasta nelja vÔi enamat pÀeva.

3

NÀdal 1 on nÀdal, mis sisaldab ainult alanud aasta pÀevi.


NĂ€ide:


Sub example_datediff
    MsgBox DateDiff("d", #1/1/2005#, #2005-12-31#)
End Sub

Palun toeta meid!