Syntax |
DatePart(interval$,date) |
|
Description |
Returns an Integer representing a specific part of a date/time expression. |
|
Comments |
The DatePart function decomposes the specified date and returns a given date/time element. The following table describes the parameters: |
|
|
Parameter |
Description |
|
Interval$ |
String expression indicating the specific time interval you wish to find the difference between. |
|
Date |
Any expression convertible to a Date. An example of a valid date/time string would be "January 1, 1995". |
|
The following table lists the valid time interval strings and the meanings of each. The Format$ function uses the same expressions. |
|
|
Time |
Interval |
|
"y" |
Day of the year |
|
"yyyy" |
Year |
|
"d" |
Day |
|
"m" |
Month |
|
"q" |
Quarter |
|
"ww" |
Week |
|
"h" |
Hour |
|
"n" |
Minute |
|
"s" |
Second |
|
"w" |
Weekday |
|
The weekday expression starts with Sunday as 1 and ends with Saturday as 7. |
|
Example |
This example displays the parts of the current date. Const crlf = Chr$(13) + Chr$(10) Sub Main() today$ = Date$ |
|
See Also |
Day (function); Minute (function); Second (function); Month (function); Year (function); Hour (function); Weekday (function), Format (function). |
D |