mrc logo mrc logo
  • m-Power m-Power
    What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • Solutions Solutions
    What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the web MS Access to the web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs and Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Services Services
    Development Services Training Mentoring
  • About About
    Overview Partners Press Releases Careers Events Contact Blog
  • Support Support
    Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • External Objects & UDFs
  • Java Date Translator
Back to Manual

Java Date Translator (External Object)

**NOTE: This Functionality Has Been Deprecated.

Please use this link to see alternative features:

https://www.mrc-productivity.com/legacy/external-objects-udf/mrc-date-conversion-udfs

 
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 (*MDY6mmddyy)

6.0

20

Input: 6.0 numeric (*DMY6ddmmyy)

6.0

30

Input: 6.0 numeric (*YMD6yymmdd)

6.0

40

Input: 8.0 numeric (*MDY8mmddyyyy)

8.0

50

Input: 8.0 numeric (*DMY8ddmmyyyy)

8.0

60

Input: 8.0 numeric (*YMD8yyyymmdd)

8.0

70

Input: 5.0 numeric (*YD5yyddd)

5.0

80

Input: 7.0 numeric (*YD7yyyyddd)

7.0

90

Input: 7.0 numeric (*CMDY7cmmddyy)

7.0

100

Input: 7.0 numeric (*CDMY7cddmmyy)

7.0

110

Input: 7.0 numeric (*CYMD7cyymmdd)

7.0

120

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

8

130

Input: date field (*DMYdd/mm/yy)

8

140

Input: date field (*YMDyy/mm/dd)

8

150

Input: date field (*JULyy/ddd)

6

160

Input: date field (*ISOyyyy-mm-dd)

10

170

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

10

180

Input: date field (*EURdd.mm.yyyy)

10

190

Input: date field (*JYNyyyynnn)

7

200

Input: date field (*JYDyyyy/ddd)

8

210

Input: date field (*CMDYcmm/dd/yy)

9

220

Input: date field (*CDMYcdd/mm/yy)

9

230

Input: date field (*CYMDcyy/mm/dd)

9

240

Output/Input: 6.0 format (*MDY6mmddyy)

6.0

250

Output/Input: 6.0 format (*DMY6ddmmyy)

6.0

260

Output/Input: 6.0 format (*YMD6yymmdd)

6.0

270

Output/Input: 8.0 format (*MDY8mmddyyyy)

8.0

280

Output/Input: 8.0 format (*DMY8ddmmyyyy)

8.0

290

Output/Input: 8.0 format (*YMD8yyyymmdd)

8.0

300

Output/Input: 5.0 format (*YD5yyddd)

5.0

310

Output/Input: 7.0 format (*YD7yyyyddd)

7.0

320

Output/Input: 7.0 format (*CMDY7cmmddyy)

7.0

330

Output/Input: 7.0 format (*CDMY7cddmmyy)

7.0

340

Output/Input: 7.0 format (*CYMD7cyymmdd)

7.0

350

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

8

360

Output/Input: date format (*DMYdd/mm/yy)

8

370

Output/Input: date format (*YMDyy/mm/dd)

8

380

Output/Input: date format (*JULyy/ddd)

6

390

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

10

400

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

10

410

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

10

420

Output/Input: date format (*JYNyyyynnn)

7

430

Output/Input: date format (*JYDyyyy/ddd)

8

440

Output/Input: date format (*CMDYcmm/dd/yy)

9

450

Output/Input: date format (*CDMYcdd/mm/yy)

9

460

Output/Input: date format (*CYMDcyy/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 (*YMD6yymmdd)

DB field

24

Output/Input: 6.0 format (*MDY6mmddyy)

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 (*YMD6yymmdd)

DB field

24

Output/Input: 6.0 format (*MDY6mmddyy)

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 (*MDY6mmddyy)

DB field

26

Output/Input: 6.0 format (*YMD6yymmdd)

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 (*MDY6mmddyy)

DB field

26

Output/Input: 6.0 format (*YMD6mmddyy)

Same DB field

Note that you also might want to follow example 1 to display the true database field as MMDDYY on the screen also. Then, you would have two fields in the application. The true database field can be queried via advanced search, but the calculated field cannot. Display both fields in the application. Then paint the query header input field to the calculated field column heading and comment out the true database field column to hide the YYMMDD format.

https://www.mrc-productivity.com/techblog/?p=522

Created: February 29, 2008 | Modified: January 30, 2013

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

mrc-Productivity Series Excel Popular Video Bar Graphs Advanced Graphs Maintainer Java Compiling Report App Properties Record Selections Getting Started Graphing Bootstrap Templates Administration Data Dictionary Retrieval Production Email Build Process Parameters Retrievals Prompt Screens Admin Graph Properties RPG Dropdowns Reports Maintainers Application Properties Tomcat Summaries Form Validation Freemarker SQL Database Performance m-Painter Security Calculations External Objects Dates DB2

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© 2024 mrc. All rights reserved.