Version: 2.0
The DatePart function returns the designated part of the
date.
Interval Settings
SETTING | DESCRIPTION |
---|---|
YYYY | Year |
Q | Quarter |
M | Month |
Y | Day Of Year |
D | Day |
W | WeekDay |
WW | Week Of Year |
H | Hour |
N | Minute |
S | Second |
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
VBSunday | 1 | Sunday |
VBMonday | 2 | Monday |
VBTuesday | 3 | Tuesday |
VBWednesday | 4 | Wednesday |
VBThursday | 5 | Thursday |
VBFriday | 6 | Friday |
VBSaturday | 7 | Saturday |
VBFirstJan1 | 1 | Week of January 1 |
VBFirstFourDays | 2 | First week of the year thathas at least four days |
VBFirstFullWeek | 3 | First full week of the year |
VBUseSystem | 0 | Use the date format of the computer's regionsl settings |
VBUseSystemDayOfWeek | 0 | Use the first full day of the week as defined by the system settings |
<% =Date %>
<% =DatePart("D", Date) %>
3/16/99
16
<% =DatePart("W", 1/1/2000) %>
7
The weekday is given as a number from the Date And Time CONSTANTS which are listed below. In the example, 7 equals Saturday.
<% =DatePart("W", "1/1/2000", 3) %>
5
<% =DatePart("W", "1/1/2000", VBTUESDAY)
%>
5
In this example, Tuesday is defined to be the first day of the week.
Therefore, Saturday becomes the 5th day of the week.
<% =DatePart("WW", "12/31/1999", 1, VBFIRSTFULLWeek) %>
52
This example returns how many full 7 day weeks there were in 1999.