Programming Reference Manual
DatePart
Syntax
DatePart(
interval
,
dateexpr
)
Description
Return the number from the date corresponding to the interval.
Parameter
Description
interval
This string value indicates which kind of interval to extract.
dateexpr
Get the interval from this date value. If this value is
Null
then
Null
is returned.
Interval
Description (return value range)
yyyy
Year (100-9999)
q
Quarter (1-4)
m
Month (1-12)
y
Day of year (1-366)
d
Day (1-31)
w
Weekday (1-7)
ww
Week (1-53)
note:
see also
WeekNum
h
Hour (0-23)
n
Minute (0-59)
s
Second (0-59)
See Also
DateAdd
,
DateDiff
,
WeekNum
.
Example
Sub
Main
Debug
.
Print
DatePart
(
"yyyy"
,#1/1/2000#)
' 2000
End
Sub
Home
IDE Overview
Declarations
Data Types
Assignment
Flow Control
Error Handling
Conversion
Variable Info
Constant
Math
Financial
Strings
StringClass
Objects
Time/Date
Time/Date
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
EasterDate
Hour
Minute
Month
MonthName
Now
Second
Time
Timer
TimeSerial
TimeValue
Weekday
WeekdayName
WeekNum
Year
File
User Input
User Dialog
Dialog Functions
Web Form
CCL (web server)
DDE
Settings
Miscellaneous
Operator
Translator