Next: , Previous: , Up: Input and Output Formats   [Contents][Index] Time and Date Formats

In PSPP, a time is an interval. The time formats translate between human-friendly descriptions of time intervals and PSPP’s internal representation of time intervals, which is simply the number of seconds in the interval. PSPP has two time formats:

Time FormatTemplateExample
DTIMEDD HH:MM:SS.ss00 04:31:17.01

A date is a moment in the past or the future. Internally, PSPP represents a date as the number of seconds since the epoch, midnight, Oct. 14, 1582. The date formats translate between human-readable dates and PSPP’s numeric representation of dates and times. PSPP has several date formats:

Date FormatTemplateExample
QYRq Q yyyy3 Q 1978
MOYRmmm yyyyOCT 1978
WKYRww WK yyyy40 WK 1978
DATETIMEdd-mmm-yyyy HH:MM:SS.ss01-OCT-1978 04:31:17.01

The templates in the preceding tables describe how the time and date formats are input and output:


Day of month, from 1 to 31. Always output as two digits.


Month. In output, mm is output as two digits, mmm as the first three letters of an English month name (January, February, …). In input, both of these formats, plus Roman numerals, are accepted.


Year. In output, DATETIME always produces a 4-digit year; other formats can produce a 2- or 4-digit year. The century assumed for 2-digit years depends on the EPOCH setting (see SET EPOCH). In output, a year outside the epoch causes the whole field to be filled with asterisks (‘*’).


Day of year (Julian day), from 1 to 366. This is exactly three digits giving the count of days from the start of the year. January 1 is considered day 1.


Quarter of year, from 1 to 4. Quarters start on January 1, April 1, July 1, and October 1.


Week of year, from 1 to 53. Output as exactly two digits. January 1 is the first day of week 1.


Count of days, which may be positive or negative. Output as at least two digits.


Count of hours, which may be positive or negative. Output as at least two digits.


Hour of day, from 0 to 23. Output as exactly two digits.


Minute of hour, from 0 to 59. Output as exactly two digits.

Seconds within minute, from 0 to 59. The integer part is output as exactly two digits. On output, seconds and fractional seconds may or may not be included, depending on field width and decimal places. On input, seconds and fractional seconds are optional. The DECIMAL setting controls the character accepted and displayed as the decimal point (see SET DECIMAL).

For output, the date and time formats use the delimiters indicated in the table. For input, date components may be separated by spaces or by one of the characters ‘-’, ‘/’, ‘.’, or ‘,’, and time components may be separated by spaces, ‘:’, or ‘.’. On input, the ‘Q’ separating quarter from year and the ‘WK’ separating week from year may be uppercase or lowercase, and the spaces around them are optional.

On input, all time and date formats accept any amount of leading and trailing white space.

The maximum width for time and date formats is 40 columns. Minimum input and output width for each of the time and date formats is shown below:

FormatMin. Input WidthMin. Output WidthOption
DATE894-digit year
ADATE884-digit year
EDATE884-digit year
JDATE554-digit year
SDATE884-digit year
QYR464-digit year
MOYR664-digit year
WKYR684-digit year

In the table, “Option” describes what increased output width enables:

4-digit year

A field 2 columns wider than minimum will include a 4-digit year. (DATETIME format always includes a 4-digit year.)


A field 3 columns wider than minimum will include seconds as well as minutes. A field 5 columns wider than minimum, or more, can also include a decimal point and fractional seconds (but no more than allowed by the format’s decimal places).

For the time and date formats, the default output format is the same as the input format, except that PSPP increases the field width, if necessary, to the minimum allowed for output.

Time or dates narrower than the field width are right-justified within the field.

When a time or date exceeds the field width, characters are trimmed from the end until it fits. This can occur in an unusual situation, e.g. with a year greater than 9999 (which adds an extra digit), or for a negative value on TIME or DTIME (which adds a leading minus sign).

The system-missing value is output as a period at the right end of the field.

Next: , Previous: , Up: Input and Output Formats   [Contents][Index]