Midrange News for the IBM i Community


Posted by: rpgprogrammer
Vancouver, BC
Date Convert
has no ratings.
Published: 10 May 2012
Revised: 23 Jan 2013 - 3964 days ago
Last viewed on: 28 Nov 2023 (5127 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Date Convert Published by: rpgprogrammer on 10 May 2012 view comments(4)

Is there any way we can convert a character field having Date '120511'(6A) to 20120511(8P 0)

 

Thanks

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: Paulster
Premium member *
Sweden and The Netherlands
Comment on: Date Convert
Posted: 11 years 6 months 22 days 56 minutes ago

You mean by adding the century and making it numeric? Or by going though a proper date routine?

 

While the former is rather trivial, I think you'll find what you need on the latter option on the links below.

https://www.google.se/search?q=%25date&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a

http://www.mcpressonline.com/tips-techniques/ibm-i-os400-i5os/techtip-date-time-and-timestamp.html

 

And then there's the API way to go too, see link below.

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/ile4a1TOC.htm

 

Google's your friend...

 

 

Regards,

Paulster

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Date Convert
Posted: 11 years 6 months 21 days 17 hours 44 minutes ago

Might want a MONITOR around it, but how about %DEC(%DATE('120511':*MDY0):*ISO)?

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Date Convert
Posted: 11 years 6 months 18 days 17 hours 47 minutes ago

Actually I think the character date is *YMD0 format, but Dale is correct on the rest.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Date Convert
Posted: 11 years 6 months 18 days 17 hours 43 minutes ago

Oops