mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/

 


Java Date Translator (External Object)

 

mrc supplies a date translator specifically for use with generated Web/Servlet applications.  This Java class is named mrc.servlet.MrcDateTranslator and resides in mrcextobj.jar.

 

The object definition is shown below.  If this object definition is not on your system, then a cumulative update from August 1, 2004 or later will install it.

Object Definition

 

Object Name

MRCDATEJVA

Object Description

Java Date Translator

Where Available

0

Object Type

M

Class/exe

mrc.servlet.MrcDateTranslator

Method

convert

Classpath/path

/mrcjava/web-inf/lib/mrcextobj.jar

 

Object Parameters

 

Sequence Number

Description

Length

10

Input: 6.0 numeric (*MDY6 mmddyy)

6.0

20

Input: 6.0 numeric (*DMY6 ddmmyy)

6.0

30

Input: 6.0 numeric (*YMD6 yymmdd)

6.0

40

Input: 8.0 numeric (*MDY8 mmddyyyy)

8.0

50

Input: 8.0 numeric (*DMY8 ddmmyyyy)

8.0

60

Input: 8.0 numeric (*YMD8 yyyymmdd)

8.0

70

Input: 5.0 numeric (*YD5 yyddd)

5.0

80

Input: 7.0 numeric (*YD7 yyyyddd)

7.0

90

Input: 7.0 numeric (*CMDY7 cmmddyy)

7.0

100

Input: 7.0 numeric (*CDMY7 cddmmyy)

7.0

110

Input: 7.0 numeric (*CYMD7 cyymmdd)

7.0

120

Input: date field (*MDY mm/dd/yy)

8

130

Input: date field (*DMY dd/mm/yy)

8

140

Input: date field (*YMD yy/mm/dd)

8

150

Input: date field (*JUL yy/ddd)

6

160

Input: date field (*ISO yyyy-mm-dd)

10

170

Input: date field (*USA mm/dd/yyyy)

10

180

Input: date field (*EUR dd.mm.yyyy)

10

190

Input: date field (*JYN yyyynnn)

7

200

Input: date field (*JYD yyyy/ddd)

8

210

Input: date field (*CMDY cmm/dd/yy)

9

220

Input: date field (*CDMY cdd/mm/yy)

9

230

Input: date field (*CYMD cyy/mm/dd)

9

240

Output/Input: 6.0 format (*MDY6 mmddyy)

6.0

250

Output/Input: 6.0 format (*DMY6 ddmmyy)

6.0

260

Output/Input: 6.0 format (*YMD6 yymmdd)

6.0

270

Output/Input: 8.0 format (*MDY8 mmddyyyy)

8.0

280

Output/Input: 8.0 format (*DMY8 ddmmyyyy)

8.0

290

Output/Input: 8.0 format (*YMD8 yyyymmdd)

8.0

300

Output/Input: 5.0 format (*YD5 yyddd)

5.0

310

Output/Input: 7.0 format (*YD7 yyyyddd)

7.0

320

Output/Input: 7.0 format (*CMDY7 cmmddyy)

7.0

330

Output/Input: 7.0 format (*CDMY7 cddmmyy)

7.0

340

Output/Input: 7.0 format (*CYMD7 cyymmdd)

7.0

350

Output/Input: date format (*MDY mm/dd/yy)

8

360

Output/Input: date format (*DMY dd/mm/yy)

8

370

Output/Input: date format (*YMD yy/mm/dd)

8

380

Output/Input: date format (*JUL yy/ddd)

6

390

Output/Input: date format (*ISO yyyy-mm-dd)

10

400

Output/Input: date format (*USA mm/dd/yyyy)

10

410

Output/Input: date format (*EUR dd.mm.yyyy)

10

420

Output/Input: date format (*JYN yyyynnn)

7

430

Output/Input: date format (*JYD yyyy/ddd)

8

440

Output/Input: date format (*CMDY cmm/dd/yy)

9

450

Output/Input: date format (*CDMY cdd/mm/yy)

9

460

Output/Input: date format (*CYMD cyy/mm/dd)

9

470

Output DAY OF YEAR  (*DY 1-366)

3.0

480

Output DAY OF MONTH  (*DM 1-31)

2.0

490

Output DAY OF WEEK (*DW 1-7)

1.0

500

Output Day of Week (*DWA Sun-Sat)

3

510

Output Day of Week (*DWF Sunday-Saturday)

10

520

Output MONTH OF YEAR (*MY 1-12)

2.0

530

Output Month of Year (*MYA Jan-Dec)

3

540

Output Month of Year (*MYF January-December)

10

550

Output YEAR in YY (*YY 00-99)

2.0

560

Output YEAR in YYYY (*YYYY 0001-9999)

4.0

570

Output: Different DAYS  (*DAY)

5.0

580

Output: Different WEEKS (*WEEK)

5.1

590

Output: Different MONTHS (*MONTH)

5.2

600

Output: Different YEARS (*YEAR)

5.3

610

Input: Add/Subtract Day On Input Date (*DAY)

4.0

620

Input: Add/Subtract Week On Input Date (*WEEK)

4.0

630

Input: Add/Subtract Month On Input Date (*MONTH)

4.0

640

Input: Add/Subtract Year On Input Date (*YEAR)

4.0

Functions                                                                       

  

Convert Date1 to Different Format Date2

·         Input Date1 (Seq 10-230)

·         Output Date2 (Seq 240-460)

Return attributes (Day/Month/Week/Year) of Date1

·         Input Date1 Seq 10-230,

  • Output Value Seq 470-560

Calculate difference between Date1 and Date2

  • Input Date1 (Seq 10-230) and Date2 (Seq 240-460)
  • Output value (Seq 570-600)

Add/Substract Field1 (Days/Weeks/Months/Year) Value to Date1

  • Input Date1 (Seq 10-230)

·         Input Field1 (Seq 610-640)

  • Output Date (Seq 240-460)

Return Server Date/Day/Week/Month/Year

  • Only map field for Output (Seq 240-560)

 

Examples of Converting Numeric Date Fields

 

Example 1: Simple Reporting Date Conversion

The database field is YYMMDD, but the user wants MMDDYY to display in the application.

 

We need to convert the true database field from YYMMDD to display it on the screen as MMDDYY.  Create a calculated field to hold the converted value and call the object once at external object template location *READRECRD, *CALCOBJ, or call it directly from the calculation.

 

Parameter Sequence #

Description

Map to Field

3

Input: 6.0 numeric (*YMD6 yymmdd)

DB field

24

Output/Input: 6.0 format (*MDY6 mmddyy)      

Calc field

 

Display the calculated field and non-display the database field.

 

Example 2: Maintain Field With Date Conversion

The database field is YYMMDD, but the user wants MMDDYY to display in the application.

 

If the maintenance application will update the numeric date database field, we need to perform two conversions.  First, we need to convert the true database field from YYMMDD to display it on the screen in format MMDDYY.  Then, when the user submits the screen to update a record, we will convert it again from screen format MMDDYY before we update the record in the database with format YYMMDD.  Therefore we will call the same object twice.  If the maintainer application will only add records, then only the second conversion is necessary since the value is not retrieved from the database for the purpose of displaying the current value.  No calculated field is needed in either case. 

 

Call the object at external object template location *READRECRD with these parameters:

 

Parameter Sequence #

Description

Map to Field

3

Input: 6.0 numeric (*YMD6 yymmdd)

DB field

24

Output/Input: 6.0 format (*MDY6 mmddyy)      

Same DB field

 

Call the object at external object template location *BEFOREACT with these parameters:

 

Parameter Sequence #

Description

Map to Field

1

Input: 6.0 numeric (*MDY6 mmddyy)

DB field

26

Output/Input: 6.0 format (*YMD6 yymmdd)      

Same DB field

 

 

Example 3: Advanced Search With Date Conversion

The database field is YYMMDD, but the user wants MMDDYY to display in the application.

 

We need to convert the value entered as MMDDYY to a match the database format of YYMMDD.  No need to create a calculated field.  Call the object once at external object location *STRADVSCH, mapping the database field as the input and the output.

 

Parameter Sequence #

Description

Map to Field

1

Input: 6.0 numeric (*MDY6 mmddyy)

DB field

26