Reads and extracts datetime values from various date, time, and datetime forms.
Category: | Date and Time |
Interaction: | If an input datetime value contains a special character for formatting characters, and the character is not B, C, N, P, or S, the ANYDTDTMw. informat reads only the date portion of the input and the time is set to 0. For example, for a EN_US locale, an input value of '150501X1' results in 01MAY15:00:00:00. |
Informat or Form of
Input
|
Example Data
|
---|---|
DATE
|
01JAN12
01JAN2012
|
DATETIME
|
01JAN12 14:30:08
01JAN2012 14:30:08.5
|
010112
01012012
|
|
JULIAN
|
12001
2012001
|
010112
01012012
|
|
01/12
01-2012
|
|
MDYAMPM 3
|
01/01/12 02:30:08 AM
01/01/2012 02:30:08
AM
|
MONYY
|
JAN12
JAN2012
|
TIME
|
14.30
14:30:08.05
|
<YY>YYMMDD 2
|
120101
20120101
|
<YY>YYQ 2
|
12Q1
2012Q1
|
12/01
2012/01
|
|
month-day-year
|
January 1, 2012
|
month-day-year
hh:mm:ss
|
January 1, 2012 12:00:00
|
1x is a special character that separates the month from the year. | |
2 <YY> indicates the century is optional. | |
3IF the month and day values are ambiguous, the value for the DATESTYLE= system option is used to determine the order. |
Use of Colons and Periods
|
Example
|
---|---|
a single colon in the
value h:m indicates
hours and minutes
|
14:30
|
two colons in the value
h:m:s indicate hours, minutes, and seconds
|
14:30:08
|
a single period in the
value m:s.ff, where ff is a fraction of a second, indicates that the
number preceding the period is the number of seconds
|
2:39.66
|
multiple periods in
the value indicate that the period is a delimiter for dates and the
value is not a time value.
|
12.25.2012
|
input dateinfo anydtdtm21.;
Data Line
|
Informat or Form of
Data
|
Result
|
Formatted with DATETIMEw.d Format
|
---|---|---|---|
----+----1----+----2 |
|
|
|
01JAN2012 |
DATE
|
1640995200 |
01JAN12:00:00:00 |
01JAN2012 14:30:08.5 |
DATETIME
|
1641047408.5 |
01JAN12:14:30:09 |
01012012 |
DDMMYY
|
1640995200 |
01JAN12:00:00:00 |
2012001 |
JULIAN
|
1546387200 |
01JAN12:00:00:00 |
01/01/12 |
MMDDYY
|
1546387200 |
01JAN12:00:00:00 |
01-12 |
MMxYY
|
1546387200 |
01JAN12:00:00:00 |
JAN2012 |
MONYY
|
1546387200 |
01JAN12:00:00:00 |
14:30 |
TIME
|
52200 |
01JAN60:14:30:00 |
20120101 |
YYMMDD
|
1546387200 |
01JAN12:00:00:00 |
12Q1 |
YYQ
|
1546387200 |
01JAN12:00:00:00 |
January 1, 2012 |
month-day-year
|
1546387200 |
01JAN12:00:00:00 |