Converting date for output to a display or printer in Query for iSeries
You can use the date functions to convert an input date field to a different format. Examples 1 and 2 show
two methods of converting a date field from the MMDDYY format to the YYDDD format. Examples 3 and 4
show the reverse conversions, from YYDDD to MMDDYY format.
Note:
For ease of reading, multiple panel views are merged into single screen images.
Example 1—Converting from MMDDYY to YYDDD format in Query for iSeries
The following Define Result Fields panel defines an MMDDYY to YYDDD date conversion. The conversion
is done completely within the panel.
Define Result Fields
Type definitions using field names or constants and operators, press Enter.
Operators: +, -, *, /, SUBSTR, ||, DATE...
Field
Expression
Column Heading
Len Dec
YY________ SUBSTR(CHAR(MMDDYY),7,2)_________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
CHARJAN01_ ’01/01/’ || YY___________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
JAN01_____ DATE(CHARJAN01)__________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
DDD_______ SUBSTR(DIGITS(DAYS(MMDDYY)-DAYS(J ____________________ _____ __
AN01)+1),10,3)___________________ ____________________
_________________________________ ____________________
YYDDD_____ YY_||_’/’_||_DDD_________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
_______________________________________________________________________________
Field
Text
Len Dec
MMDDYY
Date field in MMDDYY format
8
L
Bottom
F3=Exit
F5=Report
F9=Insert
F11=Display names only
F12=Cancel
F13=Layout
F20=Reorganize
F24=More keys
Example 2—Converting from MMDDYY to YYDDD format in Query for iSeries
This examples shows an alternative method for the same conversion done in example 1. The conversion
is done completely within the panel. This method requires that the date format for the current job must be
set to YYDDD. When this circumstance exists, the DATE function automatically does the conversion.
Chapter 5. Defining result fields in Query for iSeries
81
Содержание ISERIES SC41-5210-04
Страница 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 2: ......
Страница 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 12: ...x Query for iSeries Use V5R2 ...
Страница 14: ...2 Query for iSeries Use V5R2 ...
Страница 18: ...Figure 3 Major Tasks on the Query Menu and the Work with Queries Display 6 Query for iSeries Use V5R2 ...
Страница 32: ...20 Query for iSeries Use V5R2 ...
Страница 38: ...26 Query for iSeries Use V5R2 ...
Страница 44: ...32 Query for iSeries Use V5R2 ...
Страница 116: ...104 Query for iSeries Use V5R2 ...
Страница 122: ...110 Query for iSeries Use V5R2 ...
Страница 146: ...134 Query for iSeries Use V5R2 ...
Страница 150: ...138 Query for iSeries Use V5R2 ...
Страница 174: ...162 Query for iSeries Use V5R2 ...
Страница 178: ...166 Query for iSeries Use V5R2 ...
Страница 196: ...184 Query for iSeries Use V5R2 ...
Страница 198: ...186 Query for iSeries Use V5R2 ...
Страница 204: ...192 Query for iSeries Use V5R2 ...
Страница 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Страница 206: ...194 Query for iSeries Use V5R2 ...
Страница 210: ...198 Query for iSeries Use V5R2 ...
Страница 242: ...230 Query for iSeries Use V5R2 ...
Страница 256: ...244 Query for iSeries Use V5R2 ...
Страница 270: ...258 Query for iSeries Use V5R2 ...
Страница 272: ...260 Query for iSeries Use V5R2 ...
Страница 292: ...280 Query for iSeries Use V5R2 ...
Страница 293: ......
Страница 294: ... Printed in U S A SC41 5210 04 ...