This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help

Previous Topic

Up

Next Topic

Date Calculations and Expressions

Date Expressions are used to specify calculations on dates. They are used in the specification of the values of Derived Date variables and may be used as part of the expressions for logical expressions. Date expressions are either:

A number (of days) added to or subtracted from a date to get another date.

Two dates compared together to see if one is greater than, less than, equal to, or not equal to the other. For example, Q1 < 10 September 2004 would give TRUE if the response to Q1 was a date before September 10th 2004. It would be FALSE otherwise.

A date function applied to a date, for example to extract the day of the week represented by a date.

The possible operands and operators are fully described in the following sections.

Table of date operands for use with date expressions

Operand

Description

Date Variable

A Question Date or a Derived Date variable

Date Constant

A date value expressed as a constant. Any of the formats acceptable to date variables are acceptable. For example, 10th November 2004 could be 10/11/04 (or 11/10/04 depending on locale), 10-Nov-04 or November 10, 2004.

Date Property

The word TODAY which returns today's date (according to the date set on the computer that is running Snap).

Date Function

Used to extract parts of a date. The name of a variable followed by a date function.

Date Operator

Find the number of days between two dates, add a number of days onto a date or subtract a number of days from a date.

Comparison

Comparisons relate variable or constant values to give a TRUE or FALSE result. The effects of relational operations are described fully in the section entitled 'Relational Operators'.

In this section