Difference between revisions of "WEEK()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
==Class==
 
Date And Time Data
 
 
 
 
==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.
Line 20: Line 16:
  
 
{| class="wikitable"
 
{| class="wikitable"
!Parameter||Description
+
!width=50%|Parameter||Description
 
|-
 
|-
 
|<expD>||Date expression for which to return the week number
 
|<expD>||Date expression for which to return the week number
Line 37: Line 33:
  
 
{| class="wikitable"
 
{| class="wikitable"
!Value||Setting
+
!width=50%|Value||Setting
 
|-
 
|-
 
|0||First week contains January 1<sup>st</sup>
 
|0||First week contains January 1<sup>st</sup>
Line 54: Line 50:
  
 
{| class="wikitable"
 
{| class="wikitable"
!Value||Setting
+
!width=50%|Value||Setting
 
|-
 
|-
 
|0||Sunday
 
|0||Sunday
Line 92: Line 88:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Date and Time Data]]
 
[[Category:Date and Time Data]]
 
[[Category:Date and Time Data Functions]]
 
[[Category:Date and Time Data Functions]]

Latest revision as of 15:51, 9 February 2012

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, SET VAXTIME, 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


Products

Recital, Recital Server