DateDiff Function

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

Syntax:


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

मान फर्काउनुहोस्:

एक सङ्ख्या ।

Parameters:

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

interval (string value)

वर्णन

yyyy

वर्ष

q

चौथाई

m

महिना

y

वर्षको दिन

w

हप्ताको दिन

ww

वर्षको हप्ता

d

दिन

h

घण्टा

n

मिनट

s

दोस्रो


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

वर्णन

0

पूर्वनर्धारित मान प्रणाली प्रयोग गर्नुहोस्

1

आइतबार (पूर्वनिर्धारित)

2

सोमबार

3

मंगलबार

4

बुधबार

5

विहीवार

6

शुक्रबार

7

शनिबार


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

firstweekofyear value

वर्णन

0

पूर्वनर्धारित मान प्रणाली प्रयोग गर्नुहोस्

1

पहिलो हप्ता भनेको जनवरीको पहिलो हो, पहिलो (पूर्वनिर्धारित)

2

पहिलो हप्ता, त्यो वर्षको चार वा धेरै दिनहरू समावेश भएको पहिलो हप्ता हो

3

पहिलो हप्ता नयाँ वर्षको दिनहरू मात्र समावेश भएको पहिलो हप्ता हो


Example:


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

कृपया हामीलाई समर्थन गर्नुहोस्!