Snap XMP Help

Analysing date responses

< All Topics
image_pdfimage_print

Dates can be analysed in a number of ways as follows:

  • Dates can be categorised as falling in particular years, months or weeks of the year, or on particular days of the week.
  • The difference between two dates can be calculated, such as calculating a respondent’s age. These can be categorised or grouped into appropriate ranges or used in the production of descriptive statistics.

Date formats

A wide range of date formats are supported. All dates are based on the Gregorian calendar.

Day

The day number must appear in the range 1 to 31, with optional leading zeros. For example, 01, 02 are acceptable. The validity of a day number will be checked in conjunction with the month. For example, 31 September will be invalid. In the case of February, the year will also be checked for the occurrence of a leap year.

The day number can appear before or after the month, e.g. 1 Jan or Jan 1.

Day suffixes such st, nd, rd, th are not necessary and are not accepted, unless a suitable date pattern has been applied to the variable.

Local rules for date, such as the US standard of Month/Day/Year, will be recognised. Consequently, 01/05/97 will be calculated as January 5th 1997 in the US and May 1st 1997 in the UK (the computer date settings control these formats).

The day number must be separated from the month by either a full stop (.), a hyphen (-) or a slash (/) or, if the month is expressed as a word, by a space.

In the special case where the month name is given before the day number, a comma can be used to separate the day and year, e.g. January 5,1997

Month

The month can appear in full, e.g. January, or abbreviated to the first 3 characters, e.g. Jan, or as a number, e.g. 01.

The only exceptions to the 3 character abbreviation rule are July which can be Jul or Jly, and September which can be Sep or Sept.

The month must be separated from the day and the year by either a full stop (.), a hyphen (-) or a slash (/) or, if the month is expressed as a word, by a space.

Year

The year number can either be the last 2 digits, e.g. 97, or the full year, e.g. 1997. If the two digit number is used, it is assumed that the year is between 1930 and 2029 inclusive. Then 97 will represent 1997, 00 will represent 2000, and 29 will represent 2029. To represent any year before 1930 or any date after 2029, you should include all digits, e.g. 1929.

The year must be separated from the month by either a space, a full stop (.), a hyphen (-) or a slash (/).

Date functions

When defining dates, there are a number of functions that can be used to perform calculations and tests on the dates.

Function

Interpretation

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.

month

Gives the month number in which the date occurs.

month name

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

day

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

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.

weekday name

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

today

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

Contents