Next: , Previous: Binary and Hexadecimal Numeric Formats, Up: Input and Output Formats 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 Format Template Example
TIME 04:31:17.01
DTIME DD 00 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 Format Template Example
DATE dd-mmm-yyyy 01-OCT-1978
ADATE mm/dd/yyyy 10/01/1978
EDATE 01.10.1978
JDATE yyyyjjj 1978274
SDATE yyyy/mm/dd 1978/10/01
QYR q Q yyyy 3 Q 1978
MOYR mmm yyyy OCT 1978
WKYR ww WK yyyy 40 WK 1978
DATETIME dd-mmm-yyyy 01-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:

Format Min. Input Width Min. Output Width Option
DATE 8 9 4-digit year
ADATE 8 8 4-digit year
EDATE 8 8 4-digit year
JDATE 5 5 4-digit year
SDATE 8 8 4-digit year
QYR 4 6 4-digit year
MOYR 6 6 4-digit year
WKYR 6 8 4-digit year
DATETIME 17 17 seconds
TIME 5 5 seconds
DTIME 8 8 seconds

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.