WEEK()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return the week number for the specified date or datetime, from 1 to 53.

Syntax

WEEK(<expD> | <expT>[, <expN1>[, <expN2>]])

See Also

AMPM(), CDOW(), CMONTH(), CTOD(), CTOT(), DATE(), DATETIME(), DAY(), DAYS(), DMY(), DOW(), DTOC(), DTOM(), DTOS(), DTOV(), ELAPTIME(), EMPTY(), EPOCH(), GOMONTH(), HOUR(), HOURS(), LTOS(), MDY(), MINUTE(), MINUTES(), MONTH(), MTOD(), MTOS(), QUARTER(), SEC(), SECONDS(), SECS(), SET CENTURY, SET DATE, SET EPOCH, SET HOURS, SET MARK, SET SECONDS, STOD(), STR(), TIME(), TIMESTAMP(), TSTRING(), TTOC(), TTOD(), TYPE(), VAL(), VALIDTIME(), VTOD(), YEAR()

Description

The WEEK() function returns the week number for the specified date or datetime, from 1 to 53.

Parameter Description
<expD> Date expression for which to return the week number
<expT> Time expression for which to return the week number
<expN1> Optional first week setting
<expN2> Optional week start date setting

The optional first week setting, <expN1>, can be any of the following:

Value Setting
0 First week contains January 1st
1 First week contains January 1st (default if <expN1> not specified)
2 First week contains at least 4 days from current year.
3 First week is first full (7 day) week

The optional week start date setting, <expN2>, can be any of the following:

Value Setting
0 Sunday
1 Sunday (default if <expN2> not specified)
2 Monday
3 Tuesday
4 Wednesday
5 Thursday
6 Friday
7 Saturday

Example

? week(datetime())
? week(date(),2))
? week(date(),0,2)
 
// Week starts on Sunday (default), first week has four days in current year
? week({01/01/2004},2)
        53
// Week starts on Monday, first week has four days in current year
? week({01/01/2004},2,2)
         1