Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function returns the current date and time of the server. The date and time are given as base type dateTime, formatted as dd-mm-yyyy HH:mm:ss.

Syntax

Code Block
NOW

Return type

  • dateTime

 

UI Text Box
typenote
The NOW function returns a date- and timestamp. It is only recalculated when the expression in which you use the NOW function is reevaluated. This recalculation will not cause other expressions that use the NOW function to be reevaluated.

WEEKNUMBER

WEEKNUMBER returns the week number within the year of a given date or dateTime value. The week number is returned as an integer in the range 1 - 53. Week 1 for a year is the earliest seven day period starting at the first day of the week that contains at least days from that year. The first day of the week and the minimal days in that first week are defined by the region settings. In most cases the first day of the week is Monday and the minimal days in the first week is 4 (these are the values reflecting ISO 8601 and many national standards).

For example, January 1, 1998 was a Thursday. Then week 1 of 1998 starts on December 29, 1997, and ends on January 4, 1998. If, however, the first day of the week is defined as Sunday (as is the case in the US), then week 1 of 1998 starts on January 4, 1998, and ends on January 10, 1998; the first three days of 1998 then are part of week 53 of 1997.

Syntax

Code Block
WEEKNUMBER ( date | dateTime )
  • date or dateTime - The date or dateTime value of which the week number must be returned.

Return type

  • integer

Examples

  • WEEKNUMBER ( DATE ( 2015 , 01 , 01 ) ) = 1
  • WEEKNUMBER ( DATE DATETIME ( 2014 , 12 , 29 , 0 , 0 , 0 ) ) = 1
  • WEEKNUMBER ( DATE ( 2015 , 12 , 28 ) ) = 53
  • WEEKNUMBER ( DATE ( 2016 , 01 , 02 ) ) = 53
  • WEEKNUMBER ( DATE ( 2016 , 01 , 04 ) ) = 1
 

DAYOFWEEK

 

DAYOFWEEK returns the number of the day within the week of a given date or dateTime value, as follows:

  • Sunday = 1
  • Monday = 2
  • Tuesday = 3
  • Wednesday = 4
  • Thursday = 5
  • Friday = 6
  • Saturday = 7

Syntax

Code Block
DAYOFWEEK( date | dateTime )
  • date or dateTime - The date or dateTime value of which the week number must be returned.

Return type

  • integer

Examples

  • DAYOFWEEK ( DATE ( 2015 , 01 , 01 ) ) = 5
  • DAYOFWEEK ( DATE DATETIME ( 2015 , 12 , 28 , 0 , 0 , 0 ) ) = 2
  • DAYOFWEEK ( DATE ( 2016 , 01 , 02 ) ) = 7
  • DAYOFWEEK ( ? ) = ?