FORMAT_DATE function

Functions

FORMAT_DATE{[FORMAT]}

This function converts the target character string based on the specified date format.

If the target character string is null or only blank characters(including tabs and line breaks), the string is converted to the start date and time of the data processing.

An error occurs if the target character string is not a date character string.

For details on the date strings readable as a date format in the FORMAT_DATE function, see the description about the date types in DataMagic Operation Manual.

Parameters

FORMAT

Specify a date format. (This parameter can be omitted).

The format to be specified is the same as the date format.

If this parameter is omitted, "YYYY/MM/DD" is set.

Input/output relationships

The table below explains the relationships between the field type of input data and the field type of output data.

Table A.3 FORMAT_DATE input/output

Input

Output

X

M

N

M

M

M

D

M

W

M

9 (numeric character string)

M

I

Error

 

A list of output formats is shown in the following table.

Table A.4 List of output formats

#

String

Description

1

YYYY

Year A.D. (4 digits)

2

YY

Year A.D. (last 2 digits)

Note that the year will be assumed to be in the 2000s.

Example: If YY is 18, it means 2018.

3

EYY

Era name (abbreviated) + Japanese calendar year (00 through 99) (e.g., T09, S25)

4

EEYY

Era name + Japanese calendar year (00 through 99) (e.g., 大正09, 昭和25)

5

eyy

Abbreviated form of Japanese era name and Japanese calendar year (0 to 99) (for example, T9 or S25)

6

eeyy

Japanese era name and Japanese calendar year (0 to 99) (for example, 大正9 or 昭和25)

7

MM

Month (01 through 12)

8

mm

Month (1 through 12)

9

DD

Date (01 through 31)

10

dd

Date (1 through 31)

11

HH or HH24

Hour (00 through 23)

12

hh or hh24

Hour (0 through 23)

13

HH12

Hour (01 through 12)

14

hh12

Hour (1 through 12)

15

MI

Minute (00 through 59)

16

mi

Minute (0 through 59)

17

SS

Second (00 through 59)

18

ss

Second (0 through 59)

19

MON

Month name (abbreviated) (all uppercase) (e.g., JAN)

20

Mon

Month name (abbreviated) (only first letter uppercase) (e.g., Jan)

21

mon

Month name (abbreviated) (all lowercase) (e.g., jan)

22

MONTH

Month name (all uppercase) (e.g., JANUARY)

23

Month

Month name (only first letter uppercase) (e.g., January)

24

month

Month name (all lowercase) (e.g., january)

25

AM

AM: morning or PM: afternoon

26

Am

Am: morning or Pm: afternoon

27

am

am: morning or pm: afternoon

28

A.M.

A.M.: morning or P.M.: afternoon

29

a.m.

a.m.: morning or p.m.: afternoon

= Remarks =
  • For details on date-advancement behavior, see the explanation of the DataMagic auto-evaluation process for loading date data in DataMagic Operation Manual.

  • To specify a delimiter character, you can use characters other than those shown in the above table.

  • For DataMagic to support a Japanese era name that is more recent than 平成, it is necessary to specify the new Japanese era name in the Japanese era name (era_name) field of the system environment settings file (huledenv.conf).

Example

Examples of the FORMAT_DATE function are shown in the following table.

Table A.5 Examples of FORMAT_DATE conversion

Input

FORMAT_DATE function specification

Result

20180430

FORMAT_DATE{YYYY/MM/DD}

2018/04/30

20180430

FORMAT_DATE{}

2018/04/30

20180430

FORMAT_DATE{MM/DD/YY}

04/30/18