Creator Help

getWeekOfYear

This topic describes the syntax and usage of the getWeekOfYear function in Zoho Creator .

Description

The getWeekOfYear function returns a number in the range (1 - 52), representing the number of the week in the year. For example, "16/1/2007" returns 3.

Syntax

<date>.getWeekOfYear()

(or)

getWeekOfYear(date)

// this format is supported only in the free flow scripting mode of Script builder.

The getWeekOfYear function syntax has the following arguments.

date  - The date based on which the number of the week is returnedThe date can be a date or date-time field, the "today" variable which returns the current day, or results of other date functions, for example, datevalue()

Example

a.If Transaction date is Aug 21, 2013, the getWeekOfYear() function returns 34.

   TransactionDate.getWeekOfYear(); 
   getWeekOfYear(TransactionDate); 

Create a view using the getWeekOfYear() function to display records belonging to that specific week

It is possible to create a view using the getWeekOfYear() function to display records belonging to that specific week. The getWeekOfYear() function can be used to view records whose date field belongs to the current week. To do this,

1. Create a Formula field in your form with the following expression as given below, where Date_1 is the name of the date field in your form. You can also use the Added_Time field instead of your Date field, based on your requirement. The formula expression will return the week number in the Formula field.

Date_1.getWeekOfYear()

2. Specify the Advanced View criteria as given below, where Formula_1 is the name of the formula field added above.This will list all the records belonging to the current week.

Formula_1 == zoho.currentdate.getWeekOfYear()

Top