DTOU( ) function

Converts an Analytics date value to a Unicode string in the specified language and locale format. Abbreviation for "Date to Unicode".

Note

This function is specific to the Unicode edition of Analytics. It is not a supported function in the non-Unicode edition.

Syntax

DTOU(<date> <,locale> <,style>)

Parameters

Name Type Description
date

optional

datetime

The field, expression, or literal value to convert to a Unicode string. If omitted, the current operating system date is used.

The date can contain a datetime value, but the time portion of the value is ignored. Standalone time values are not supported.

You can specify a field or a literal date value:

  • Field can use any date format, as long as the field definition correctly defines the format
  • Literal must use one of the YYYYMMDD or YYMMDD formats, for example `20141231`

The minimum supported date value is 31 December 1969.

locale

optional

character

The locale code that specifies the language of the output string, and optionally the version of the language associated with a particular country or region.

For example, "zh" specifies Chinese, and "pt_BR" specifies Brazilian Portuguese.

If omitted, the default locale for your computer is used. If a language is specified, but no country is specified, the default country for the language is used.

You cannot specify locale if you have not specified date.

For information about locale codes, see www.unicode.org.

style

optional

numeric

The date format style to use for the Unicode string. The format style matches the standard for the locale you specify:

  • 0 – full specification format, such as "Sunday, September 18, 2016"
  • 1 – long format, such as "September 18, 2016"
  • 2 – medium format, such as "Sep 18, 2016"
  • 3 – short, numeric format such as "9/18/16"

If omitted, the default value of 2 is used. You cannot specify style if you have not specified date and locale.

Output

Character.

Examples

Basic examples

Literal input values

Returns "31 de dezembro de 2014":

DTOU(`20141231`, "pt_BR", 1)

Returns "31 grudnia 2014":

DTOU(`20141231`, "pl", 1)

Field input values

Returns each numeric date in the Invoice_date field as a Unicode string:

DTOU(Invoice_date, "zh", 1)

Output uses full date style

Returns "星期三, 2014 十二月 31" (no region identifier specified):

DTOU(`20141231`, "zh", 0)

Returns "2014年12月31日星期三" (region identifier specified):

DTOU(`20141231`, "zh_CN", 0)

Output uses long date style

Returns "2014 十二月 31" (no region identifier specified):

DTOU(`20141231`, "zh", 1)

Returns "2014年12月31日" (region identifier specified):

DTOU(`20141231`, "zh_CN", 1)

Remarks

Related functions

DTOU( ) is the inverse of the UTOD( ) function, which converts a Unicode string to a date.

ACL Scripting Guide 14.1