Differences

This shows you the differences between two versions of the page.

Link to this comparison view

expression function - week of the year [2016/09/14 14:19] (current)
Line 1: Line 1:
 +====== Week of the Year (Expression Function) ======
  
 +===== Purpose =====
 +The **Week of the Year** function (WEEK_OF_THE_YEAR) generates a number that represents the week of the year as defined by the ISO-8601 standard format for a timestamp provided in a given timezone. ​
 +
 +{{:​week_of_the_year_initial.png?​direct&​600|}}
 +
 +===== Parameters =====
 +The **Week of the Year** function has two parameters, one of which is required:
 +
 +==== Timestamp ====
 +
 +Allowed Inputs: [[Field|field]] value or a number representing a Unix timestamp.
 +
 +There are several sources of Unix timestamps available. ​ For example the stored value of a [[Field Type - Date|date]] or [[Field Type - Date Time| date time]] field is a Unix timestamp. ​ Also When using the advanced interface the output of the [[Expression Function - Date|date]] or [[Expression Function - Date and Time| date time]] expression function is a Unix timestamp.
 +
 +==== Timezone ====
 +
 +Allowed Inputs: [[Field|field]] value or a text string
 +
 +The second optional parameter of the **Week of the Year** function is a string that represents the timezone. ​ Either use the  query builder to choose a field that contains the value or use type a value to enter a number. ​ The value should be based on the tz (timezone) database used by Linux and other Unix system in the form “Area/​Location” e.g. "​America/​New_York"​. ​ If no value is provided then the current user's timezone is used.
 +
 +===== Output =====
 +
 +The output of the **Week of the Year** function is number representing the week of the year as defined by the ISO-8601 where weeks start on monday.
 +===== Example =====
 +
 +Because weeks my cross year boundries then it is possible for a day to return a week number based on the next or previous calendar year.  December 31, 2012 is a Monday and therefor is considered part of the first week of 2013 for example WEEK_OF_THE_YEAR(1357009728,"​America/​New_York"​) will return "​01"​. December 30, 2012 is a Sunday so it is part of the last week of 2012 and WEEK_OF_THE_YEAR(1356923807,"​America/​New_York"​) will return "​52"​.
expression function - week of the year.txt · Last modified: 2016/09/14 14:19 (external edit)
Copyright WorkXpress, 2019