9 28 CONVERTDATE

LANSA Technical

9.28 CONVERTDATE

Þ Note: Built-In Function Rules.

Converts format of alphanumeric date.

Using the CONVERTDATE Built-In Function twice and producing 2 different result fields allows you to produce dates such as: THURSDAY 5TH OCTOBER 1987.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

YES

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Date that is to be converted

1

20

 

 

2

A

Req

Format of date to be converted

1

1

 

 

3

A

Req

Format required of date in return value

1

1

 

 

 

 

Valid Date Formats

  • Date to be converted: A, B, C, D, E, F, G, H, I, J, K, L, M, V, W, X, Y, Z and 1.
  • Date to be returned: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z and 1.

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Returned converted date

1

20

 

 

2

A

Opt

Return code (Y or N) for successful conversion

1

1

 

 

 

 

Technical Notes

  • All dates must have a four character year so that accurate comparisons and calculations can be performed. Where a two character year (e.g. DDMMYY, YYMMDD, MMYY) is supplied the century value is retrieved from the system definition data area. The year supplied is compared to a year in the data area, if the supplied year is less than or equal to the comparison year then the less than century is used. If the supplied year, is greater than the comparison year, then the greater than century is used.
  • When using date formats P, Q, R, S, T, U, the date is returned in the format specified in messages BIF0101 and BIF0102 in DC@M01. To have the date returned in a language other than English you should ensure these messages are translated into the appropriate language.

    If LANG is something other than ENG or NAT, you will need to ensure the messages exist in the message file for the language you are executing in.

Example

Convert a date field #YMD in date format YYMMDD (D) to date format DDMMYY (B) in field #DMY:

USE        BUILTIN(CONVERTDATE) WITH_ARGS(#YMD D B) TO_GET(#DMY)