Skip to main content

dformat

dformat

Format for the date. Valid values are:

Value Meaning
1 MM/DD/[YY]YY (07/01/97 or 03/27/2002) — American numeric format. You must specify the correct DateSeparator character (/ or .) for the current locale.
2 DD Mmm [YY]YY (01 Jul 97 or 27 Mar 2002)
3 [YY]YY-MM-DD (1997-07-01 or 2002-03-27) - ODBC format
4 DD/MM/[YY]YY (01/07/97 or 27/03/2002) — European numeric format. You must specify the correct DateSeparator character (/ or .) for the current locale.
5 Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002)
6 Mmm D YYYY (Jul 1 1997 or Mar 27 2002)
7 Mmm DD [YY]YY (Jul 01 1997 or Mar 27 2002)
8 YYYYMMDD (19930701 or 20020327) - Numeric format
9 Mmmmm D, YYYY (July 1, 1997 or March 27, 2002)
13 [D]D/[M]M/YYYY (1/7/2549 or 27/11/2549) — Thai date format. Day and month are identical to European usage, except no leading zeros. The year is the Buddhist Era (BE) year, calculated by adding 543 years to the Gregorian year.
15 DD/MM/[YY]YY or YYYY-MM-DD or any unambiguous European date format with any DateSeparator character, or YYYYMMDD with no date separators. The DateSeparator character may be any non-alphanumeric character, including blank spaces, regardless of the DateSeparator character specified in the current locale. Also accepts monthlist names and “T”. For a complete list of valid European date formats, refer to $ZDATEH.
16 YYYYc[M]Mc[D]Dc — Japanese date format. Year, month, and day numbers are the same as other date formats; leading zeros are omitted. The Japanese characters for “year”, “month”, and “day” (shown here as c) are inserted after the year, month, and day numbers. These characters are Year=$CHAR(24180), Month=$CHAR(26376), and Day=$CHAR(26085).
17 YYYYc [M]Mc [D]Dc — Japanese date format. Same as dformat 16, except that a blank space is inserted after the “year” and “month” Japanese characters.
18 [D]D Mmmmm YYYY — Tabular Hijri (Islamic) date format with full month name. Day leading zeros are omitted; year leading zeros are included. InterSystems IRIS date -445031 (07/19/0622 C.E.) = 1 Muharram 0001.
19 [D]D [M]M YYYY — Tabular Hijri (Islamic) date format with month number. Day and month leading zeros are omitted; year leading zeros are included. InterSystems IRIS date -445031 (07/19/0622 C.E.) = 1 1 0001.
20 [D]D Mmmmm YYYY — Observed Hijri (Islamic) date format with full month name. Defaults to Tabular Hijri (dformat 18). To override tabular calculation, use the class %Calendar.Hijri to add observations of new moon crescents.
21 [D]D [M]M YYYY — Observed Hijri (Islamic) date format with month number. Defaults to Tabular Hijri (dformat 19). To override tabular calculation, use the class %Calendar.Hijri to add observations of new moon crescents.
-1 Get effective dformat value from the DateFormat property of the current locale. This is the default behavior if you do not specify dformat.
-2

$ZDATETIMEH takes an integer count of UTC seconds and returns the corresponding local $HOROLOG datetime value. This is the inverse of $ZDATETIME dformat –2. Refer to $ZDATETIME dformat –2 for further details.

The input datetime value is the value returned by the time() library function, as defined in the ISO C Programming Language Standard. For example, on POSIX-compliant systems this value is the count of seconds from January 1, 1970 00:00:00 UTC.

The tformat, monthlist, yearopt, startwin, and endwin arguments are ignored.

-3 $ZDATETIMEH takes a datetime value specified in $ZTIMESTAMP internal format, converts that value from UTC Universal time to local time, and returns the resulting value in the same internal format. The tformat, monthlist, yearopt, startwin, and endwin arguments are ignored. $ZDATETIME performs the inverse operation. (Currently, this date conversion has the time conversion anomalies described for tformat values 7 and 8. These potentially affect dates prior to 1970, dates after 2038, and local time variant boundary days, such as the beginning date or end date for Daylight Saving Time.)

Where:

Syntax Meaning
YYYY YYYY is a four-digit year. [YY]YY is a two-digit year if datetime falls within the active window for two-digit dates; otherwise it is a four-digit number.
MM Two-digit month.
D One-digit day if the day number <10. Otherwise, two digits.
DD Two-digit day.
Mmm

Mmm is a month abbreviation extracted from the MonthAbbr property of the current locale. The default values are:

“Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec”

Or an alternate month abbreviation (or name of any length) extracted from an optional list specified as the monthlist argument to $ZDATETIMEH.

Mmmmm

Full name of the month as specified by the MonthName property of the current locale. The default values are: “January February March ... November December”

Or an alternate month name extracted from an optional list specified as the monthlist argument to $ZDATETIMEH.

dformat Default

If you omit dformat or set it to -1, the dformat default depends on the localeopt argument and the NLS DateFormat property:

  • If localeopt=1 the dformat default is ODBC format. The tformat, monthlist, yearopt, mindate and maxdate argument defaults are also set to ODBC format. This is the same as setting dformat=3.

  • If localeopt=0 or is unspecified, the dformat default is taken from the NLS DateFormat property. If DateFormat=3, the dformat default is ODBC format. However, DateFormat=3 does not affect the tformat, monthlist, yearopt, mindate and maxdate argument defaults, which are as specified in the current NLS locale definition.

To determine the default date properties for your locale, invoke the GetFormatItem()Opens in a new tab NLS class method:

  WRITE ##class(%SYS.NLS.Format).GetFormatItem("DateFormat"),!
  WRITE ##class(%SYS.NLS.Format).GetFormatItem("DateSeparator")

$ZDATETIMEH will use the value of the DateSeparator property of the current locale (either / or .) as the delimiter between months, days, and the year when dformat=1 or 4.

European date format (dformat=4, DD/MM/YYYY order) is the default for many (but not all) European languages, including British English, French, German, Italian, Spanish, and Portuguese (which use a “/” DateSeparator character), as well as Czech (csyw), Russian (rusw), Slovak (skyw), Slovenian (svnw), and Ukrainian (ukrw) (which use a “.” DateSeparator character). For further details on default date formats for supported locales, refer to Dates.

dformat Settings

If dformat is 3 (ODBC format date), ODBC format defaults are also used for the tformat, monthlist, yearopt, mindate and maxdate argument defaults. Current locale defaults are ignored.

If dformat is 16 or 17 (Japanese date formats), the date format is independent of the locale setting. You can use Japanese-format dates from any InterSystems IRIS instance.

If dformat is 18, 19, 20, or 21 (Islamic date formats) and localeopt is unspecified, arguments default to Islamic defaults, rather than current locale defaults. The monthlist argument defaults to Arabic month names transliterated with Latin characters. The tformat, yearopt, mindate and maxdate arguments default to ODBC defaults. The date separator defaults to the Islamic default (a space), not the ODBC default or the current locale DateSeparator property value. If localeopt=0 current locale property defaults are used for these arguments. If localeopt=1 ODBC defaults are used for these arguments.

FeedbackOpens in a new tab