2.4.10.3 The dateTimeFormat Element

dateTimeFormat
   :baseFormat[dt_base_format]=(date | time | dateTime)
   :separatorChars?
   :mdyOrder=(dayMonthYear | monthDayYear | yearMonthDay)?
   :showYear=bool?
   :yearAbbreviation=bool?
   :showQuarter=bool?
   :quarterPrefix?
   :quarterSuffix?
   :showMonth=bool?
   :monthFormat=(long | short | number | paddedNumber)?
   :showWeek=bool?
   :weekPadding=bool?
   :weekSuffix?
   :showDayOfWeek=bool?
   :dayOfWeekAbbreviation=bool?
   :dayPadding=bool?
   :dayOfMonthPadding=bool?
   :hourPadding=bool?
   :minutePadding=bool?
   :secondPadding=bool?
   :showDay=bool?
   :showHour=bool?
   :showMinute=bool?
   :showSecond=bool?
   :showMillis=bool?
   :dayType=(month | year)?
   :hourFormat=(AMPM | AS_24 | AS_12)?
=> affix*

This element appears only in schema version 2.5 and earlier (see The visualization Element).

Data to be formatted in date formats is stored as strings in legacy data, in the format yyyy-mm-ddTHH:MM:SS.SSS and must be parsed and reformatted by the reader.

The following attribute is required.

Attribute: baseFormat

Specifies whether a date and time are both to be displayed, or just one of them.

Many of the attributes’ meanings are obvious. The following seem to be worth documenting.

Attribute: separatorChars

Exactly four characters. In order, these are used for: decimal point, grouping, date separator, time separator. Always ‘.,-:’.

Attribute: mdyOrder

Within a date, the order of the days, months, and years. dayMonthYear is the only observed value, but one would expect that monthDayYear and yearMonthDay to be reasonable as well.

Attribute: showYear
Attribute: yearAbbreviation

Whether to include the year and, if so, whether the year should be shown abbreviated, that is, with only 2 digits. Each is true or false; only values of true and false, respectively, have been observed.

Attribute: showMonth
Attribute: monthFormat

Whether to include the month (true or false) and, if so, how to format it. monthFormat is one of the following:

long

The full name of the month, e.g. in an English locale, September.

short

The abbreviated name of the month, e.g. in an English locale, Sep.

number

The number representing the month, e.g. 9 for September.

paddedNumber

A two-digit number representing the month, e.g. 09 for September.

Only values of true and short, respectively, have been observed.

Attribute: dayType

This attribute is always month in the corpus, specifying that the day of the month is to be displayed; a value of year is supposed to indicate that the day of the year, where 1 is January 1, is to be displayed instead.

Attribute: hourFormat

hourFormat, if present, is one of:

AMPM

The time is displayed with an am or pm suffix, e.g. 10:15pm.

AS_24

The time is displayed in a 24-hour format, e.g. 22:15.

This is the only value observed in the corpus.

AS_12

The time is displayed in a 12-hour format, without distinguishing morning or evening, e.g. 10;15.

hourFormat is sometimes present for elapsedTime formats, which is confusing since a time duration does not have a concept of AM or PM. This might indicate a bug in the code that generated the XML in the corpus, or it might indicate that elapsedTime is sometimes used to format a time of day.

For a baseFormat of date, PSPP chooses a print format type based on the following rules:

  1. If showQuarter is true: QYR.
  2. Otherwise, if showWeek is true: WKYR.
  3. Otherwise, if mdyOrder is dayMonthYear:
    1. If monthFormat is number or paddedNumber: EDATE.
    2. Otherwise: DATE.
  4. Otherwise, if mdyOrder is yearMonthDay: SDATE.
  5. Otherwise, ADATE.

For a baseFormat of dateTime, PSPP uses YMDHMS if mdyOrder is yearMonthDay and DATETIME otherwise. For a baseFormat of time, PSPP uses DTIME if showDay is true, otherwise TIME if showHour is true, otherwise MTIME.

For a baseFormat of date, the chosen width is the minimum for the format type, adding 2 if yearAbbreviation is false or omitted. For other base formats, the chosen width is the minimum for its type, plus 3 if showSecond is true, plus 4 more if showMillis is also true. Decimals are 0 by default, or 3 if showMillis is true.