Information icon IBM InfoSphere DataStage and InfoSphere QualityStage, Version 8.5
space Feedback

D

Converts dates to storage format and vice versa. When NLS is enabled, the locale default date format overrides any default date format set in the msg.text file.

Syntax

D [years.digits] [delimiter skip] [separator] [format.options 
[ modifiers ] ] [ E ] [ L ]

years.digits indicates the number of digits of the year to output. The default is 4. On input years.digits is ignored. If the input date has no year, the year is taken from the system date.

delimiter is any single nonnumeric character used as a field delimiter in the case where conversion must first do a group extraction to obtain the internal date. It cannot be the system delimiter.

skip must accompany the use of delimiter and is the number of delimited fields to skip in order to extract the date.

separator is the character used to separate the day, month, and year on output. If you do not specify separator, the date is converted in the form 01 DEC 1999. On input separator is ignored. If NLS is enabled and you do not specify years.digits or separator, the default date form is 01 DEC 1999.

format.options is up to six options that define how the date is output (they are ignored on input). Each format option can have an associated modifier, described below. Format options can only be used in certain combinations as described below. The options are as follows:

The following shows which format options can be used together:

Use this option...
With these options...
Y
M, MA, D, J, [modifiers]
YA
M, MA, D, [modifiers]
M
Y, YA, D, [modifiers]
MA
Y, YA, D, [modifiers]
MB
Y, YA, D, [modifiers]
D
Y, M, [modifiers]
N
Y, M, MA, MB, D, WA, [modifiers]
NA
Y, M, MA, MB, D, WA, [modifiers]
W
Y, YA, M, MA, D
WA
Y, YA, M, MA, D
WB
Y, YA, M, MA, D
Q
J
Y, [modifiers]
Z
[modifiers]

[ modifiers ] modify the output formats for the data specified by format.options. You can specify up to six modifiers, separated by commas. The commas indicate which format.option each modifier is associated with, therefore you must include all the commas, even if you want to specify only one modifier (see examples). They can be any of the following values:

Value Returned by the Status Function

If you input an invalid date to this code, it returns a valid internal date but flags the anomaly by assigning a Status function value of 3. For example, 02/29/99 is interpreted as 03/01/99, and 09/31/93 is interpreted as 10/01/93. If the input date is a null value, Status is assigned a value of 3 and no conversion occurs.

Examples

The following examples show the effect of various D conversion codes with the Iconv function:

Conversion Expression
Internal Value
X = Iconv("31 DEC 1967", "D")
X = 0
X = Iconv("27 MAY 97", "D2")
X = 10740
Iconv("05/27/97", "D2/")
X = 10740
X = Iconv("27/05/1997", "D/E")
X = 10740
X = Iconv("1997 5 27", "D YMD")
X = 10740
X = Iconv("27 MAY 97", "D DMY[,A3,2]")
X = 10740
X = Iconv("5/27/97", "D/MDY[Z,Z,2]")
X = 10740
X = Iconv("27 MAY 1997", "D DMY[,A,]")
X = 10740
X = Iconv("97 05 27", "DYMD[2,2,2]")
X = 10740

The following examples show the effect of various D conversion codes with the Oconv function:

Conversion Expression
External Value
X = Oconv(0, "D")
X = "31 DEC 1967"
X = Oconv(10740, "D2")
X = "27 MAY 97"
X = Oconv(10740, "D2/")
X = "05/27/97"
X = Oconv(10740, "D/E")
X = "27/05/1997"
X = Oconv(10740, "D-YJ")
X = "1997-147"
X = Oconv(10740, "D2*JY")
X = "147*97"
X = Oconv(10740, "D YMD")
X = "1997 5 27"
X = Oconv(10740, "D MY[A,2]")
X = "MAY 97"
X = Oconv(10740, "D DMY[,A3,2]")
X = "27 MAY 97"
X = Oconv(10740, "D/MDY[Z,Z,2]")
X = "5/27/97"
X = Oconv(10740, "D DMY[,A,]")
X = "27 MAY 1997"
X = Oconv(10740, "DYMD[2,2,2]")
X = "97 05 27"
X = Oconv(10740, "DQ")
X = "2"
X = Oconv(10740, "DMA")
X = "MAY"
X = Oconv(10740, "DW")
X = "2"
X = Oconv(10740, "DWA")
X = "TUESDAY"

PDFThis topic is also in the IBM InfoSphere DataStage Server Job Developer's Guide.

Update timestamp Last updated: 2010-09-30