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

Next Topic

Book Contents

Book Index

Date Functions

When defining dates, there are a number of functions that can be used to perform calculations and tests on the dates. All examples given below assume that the current value of the date variable Q1a is 12 Aug 06.

Function

Interpretation

Example

year

Gives the year in which the date occurs. Note that the result is always the year in full, that is, even though the date was recorded as being in 06, the year function returns 2006.

The result of Q1a year would be the number 2006

month

Gives the month number in which the date occurs.

The result of Q1a month would be the number 08

month name

Gives the name of the month in which the date occurs.

The result of Q1a month name would be August

day

Gives the day of the month in which the date occurs.

The result of Q1a day would be the number 12

weekday

Gives the day of the week on which the date occurs.

Monday is weekday 1 and Sunday is weekday 7. Dates which fall on the weekend are those where weekday is greater than 5, similarly, dates which fall in the week are those where weekday is less than 6.

12 August 2006 occurs on a Saturday therefore the result of Q1a weekday would be the number 6

 

weekday name

Gives the name of the day of the week on which the date occurs.

The result of Q1a weekday name would be Saturday

today

Acts like a variable and gives the current date as set on the computer.

today weekday name would give today's name

See Also

Date formats

Categorising date responses

Using a date function to determine the day of the week of a date

Calculating age from a date of birth