Working with Dates and Times

A number of tasks commonly performed with dates and times can be easily accomplished using the Date and Time Wizard. Using this wizard, you can:

  • Create a date/time variable from a string variable containing a date or time.
  • Construct a date/time variable by merging variables containing different parts of the date or time.
  • Add or subtract values from date/time variables, including adding or subtracting two date/time variables.
  • Extract a part of a date or time variable; for example, the day of month from a date/time variable which has the form mm/dd/yyyy.

The examples in this section use the data file upgrade.sav. See the topic Sample Files for more information.

To use the Date and Time Wizard:

  1. From the menus choose:

Transform > Date and Time Wizard...

Figure 1. Date and Time Wizard introduction screen
Date and Time Wizard introduction screen

The introduction screen of the Date and Time Wizard presents you with a set of general tasks. Tasks that do not apply to the current data are disabled. For example, the data file upgrade.sav doesn't contain any string variables, so the task to create a date variable from a string is disabled.

If you're new to dates and times in IBM® SPSS® Statistics, you can select Learn how dates and times are represented and click Next. This leads to a screen that provides a brief overview of date/time variables and a link, through the Help button, to more detailed information.

Next