The datepart function takes a Julian-day value d (double) and returns that portion identified by specifier datepart$. Optional parameter n applies only to datepart$ = ww or w.
See this note.
Datepart(datepart$, d [, n])
d
datepart$
datepart$ | Unit |
---|---|
yyyy | year |
q | quarter |
m | month |
y | day of the year |
d | day of the month |
ww | week of the year |
w | day (number) of the week |
h | hour |
n | minute |
s | second |
ms | milliseconds |
do | date only (time portion removed) |
to | time only (date portion removed). Return time as fraction of a day. |
dyt | day of year, with time as fraction of day |
n
0 (default) | Returns 0 (Sunday) through 6 (Saturday) |
---|---|
1 | Returns 1 (Sunday) through 7 (Saturday) |
2 | Returns 0 (Monday) through 6 (Sunday) |
3 | Returns 1 (Monday) through 7 (Sunday) |
Portion of the Julian-day value returned as a double.
datepart(yyyy, 2457360.5107885)=; // returns 2015
datepart(y, Today())=; // returns the day number of the current year
datepart(w, 2457360.5107885, 1)=; // returns 6
datepart(w, 2457360.5107885)=; // returns 5