DatePart Function

ཚེས་གྲངས་ཡན་ལག་ལས་འགན་འདི་གིས་གསལ་བཀོད་འབད་ཡོད་པའི་ཚེས་གྲངས་ཀྱི་ཡན་ལག་སླར་ལོག་འབདཝ་ཨིན།

Syntax:


DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long

གནས་གོང་སླར་ལོག:

The extracted part for the given date.

Parameters:

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

interval (string value)

འགྲལེལ་བཤད།

yyyy

ལོ།

q

དཔྱ་གསུམ།

m

ཟླ།

y

ལོའི་ཉིནམ།

w

བདུན་ཕྲག་ཉིནམ།

ww

ལོའི་བདུན་ཕྲག

d

ཉིནམ།

h

ཆུ་ཚོད།

n

སྐར་མ།

s

སྐར་ཆ།


date - The date from which the result is calculated.

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

བདུན་ཕྲག་ ༡་ འདི་སྤྱི་ཟླ་དང་པ་ ༡་ དང་ཅིག་ཁར་བདུན་ཕྲག་༡་པ་ཨིན (default)

2

བདུན་ཕྲག་ ༡་ འདི་ཉིནམ་བཞི་ཡོད་པའི་བདུན་ཕྲག་དང་པ་ཡང་ན་ལོ་འདིའི་ཉིནམ་ལྷགཔ་ཨིན།

3

བདུན་ཕྲག་ ༡་ འདི་ལོ་གསརཔ་གི་ཉིནམ་རྐྱངམ་ཅིག་ཡོད་པའི་བདུན་ཕྲག་དང་པ་ཨིན།


Example:


Sub example_datepart
    MsgBox DatePart("ww", #12/31/2005#)
    MsgBox DatePart(date:=#1999-12-30#, interval:="q")
End Sub

Please support us!