Difference between revisions of "WEEK()"

From Lianjapedia
Jump to: navigation, search
(Products)
 
(See Also)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to return the week number for the specified date or datetime, from 1 to 53.
 
Function to return the week number for the specified date or datetime, from 1 to 53.
 
  
 
==Syntax==
 
==Syntax==
 
WEEK(<expD> | <expT>[, <expN1>[, <expN2>]])
 
WEEK(<expD> | <expT>[, <expN1>[, <expN2>]])
 
  
 
==See Also==
 
==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]], [[SET VAXTIME]], [[STOD()]], [[STR()]], [[TIME()]], [[TIMESTAMP()]], [[TSTRING()]], [[TTOC()]], [[TTOD()]], [[TYPE()]], [[VAL()]], [[VALIDTIME()]], [[VTOD()]], [[YEAR()]]
+
[[AMPM()]], [[CDOW()]], [[CMONTH()]], [[CTOD()]], [[CTOT()]], [[DATE()]], [[DATETIME()]], [[DAY()]], [[DAYS()]], [[DMY()]], [[DOW()]], [[DTOA()]], [[DTOC()]], [[DTOM()]], [[DTOS()]], [[DTOT()]], [[DTOV()]], [[ELAPTIME()]], [[EMPTY()]], [[EPOCH()]], [[GOMONTH()]], [[HOUR()]], [[HOURS()]], [[ISLEAPYEAR()]], [[LEAPYEARS()]], [[LTOS()]], [[MDY()]], [[MINUTE()]], [[MINUTES()]], [[MONTH()]], [[MTOD()]], [[MTOS()]], [[QUARTER()]], [[SEC()]], [[SECONDS()]], [[SECS()]], [[SET CENTURY]], [[SET DATE]], [[SET EPOCH]], [[SET HOURS]], [[SET MARK]], [[SET SECONDS]], [[STOD()]], [[STOT()]], [[STR()]], [[STRFTIME()]], [[TIME()]], [[TIMEOFDAY()]], [[TIMESTAMP()]], [[TSTRING()]], [[TTOC()]], [[TTOD()]], [[TYPE()]], [[VAL()]], [[VALIDTIME()]], [[VTOD()]], [[YEAR()]]
 
+
  
 
==Description==
 
==Description==
 
The WEEK() function returns the week number for the specified date or datetime, from 1 to 53.
 
The WEEK() function returns the week number for the specified date or datetime, from 1 to 53.
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Parameter||Description
!Parameter||Description
+
 
|-
 
|-
|<expD>||Date expression for which to return the week number
+
|valign="top"|<expD>||Date expression for which to return the week number
 
|-
 
|-
|<expT>||Time expression for which to return the week number
+
|valign="top"|<expT>||Time expression for which to return the week number
 
|-
 
|-
 
|<expN1>||Optional first week setting
 
|<expN1>||Optional first week setting
Line 27: Line 23:
 
|-
 
|-
 
|}
 
|}
 
  
 
The optional first week setting, <expN1>, can be any of the following:
 
The optional first week setting, <expN1>, can be any of the following:
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Value||Setting
!Value||Setting
+
 
|-
 
|-
 
|0||First week contains January 1<sup>st</sup>
 
|0||First week contains January 1<sup>st</sup>
 
|-
 
|-
|1||First week contains January 1<sup>st</sup> (default if <expN1> not specified)
+
|valign="top"|1||First week contains January 1<sup>st</sup> (default if <expN1> not specified)
 
|-
 
|-
|2||First week contains at least 4 days from current year.
+
|valign="top"|2||First week contains at least 4 days from current year.
 
|-
 
|-
 
|3||First week is first full (7 day) week
 
|3||First week is first full (7 day) week
 
|-
 
|-
 
|}
 
|}
 
  
 
The optional week start date setting, <expN2>, can be any of the following:
 
The optional week start date setting, <expN2>, can be any of the following:
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Value||Setting
!Value||Setting
+
 
|-
 
|-
 
|0||Sunday
 
|0||Sunday
Line 69: Line 61:
 
|-
 
|-
 
|}
 
|}
 
 
  
 
==Example==
 
==Example==
Line 86: Line 76:
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Date and Time Data]]
 
 
[[Category:Date and Time Data Functions]]
 
[[Category:Date and Time Data Functions]]

Latest revision as of 08:49, 8 October 2019

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(), DTOA(), DTOC(), DTOM(), DTOS(), DTOT(), DTOV(), ELAPTIME(), EMPTY(), EPOCH(), GOMONTH(), HOUR(), HOURS(), ISLEAPYEAR(), LEAPYEARS(), LTOS(), MDY(), MINUTE(), MINUTES(), MONTH(), MTOD(), MTOS(), QUARTER(), SEC(), SECONDS(), SECS(), SET CENTURY, SET DATE, SET EPOCH, SET HOURS, SET MARK, SET SECONDS, STOD(), STOT(), STR(), STRFTIME(), TIME(), TIMEOFDAY(), 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