WEEK Function
The WEEK function converts a DATE or TIMESTAMP expression into an INTEGER value in the
range 1 through 54 that represents the corresponding week of the year. If the year begins on a
Sunday, the value 1 will be returned for any datetime that occurs in the first 7 days of the year.
Otherwise, the value 1 will be returned for any datetime that occurs in the partial week before
the start of the first Sunday of the year. The value 53 is returned for datetimes that occur in the
last full or partial week of the year except for leap years that start on Saturday where December
31 is in the 54th full or partial week.
WEEK is a Neoview SQL extension.
WEEK (datetime-expression)
datetime-expression
is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See
"Datetime Value Expressions" (page
Example of WEEK
•
Return an integer that represents the week of the year from the START_DATE column in
the PROJECT table:
SELECT start_date, ship_timestamp, WEEK(start_date)
FROM persnl.project
WHERE projcode = 1000;
Start/Date
----------
2008-04-10
Time/Shipped
--------------------------
2008-04-21 08:15:00.000000
257).
(EXPR)
--------------
15
WEEK Function
487