PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Centurion date

View previous topic View next topic Go down

Centurion date

Post  soundhar on Tue Mar 22, 2011 9:40 pm

Dear PMS,
I am having a field in PF as " date 7p0"
I want to store this 'date' numeric field into a centurion date through rpg iv...
Try yourself and post it here...
More than one solutions expected...

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Knowledge sharing

Post  soundhar on Thu Mar 24, 2011 3:08 pm

Hi,
cymd = cyymmdd = 1110324(today's date in centurion format)
DPSDS SDS <-program status data structure
D USER 358 367A
D DATE 191 198 0 <- getting today's date from ds
D TIME 282 287S 0
**CENTURION DATE FROM DATA STRUCTURE
D Cent DS
D C 1 1 inz('1')
D YR 2 3
D MTH 4 5
D DT 6 7
D CDT s 8A
Eval CDT = %Char(DATE)
Eval YR = %Subst(CDT:3:2)
Eval MTH = %Subst(CDT:5:2)
Eval DT = %Subst(CDT:7:2)

Eval DATe1 = %Dec(Cent:7:0) <- DATe1 =1110324 if DATE = 20110324


Last edited by soundhar on Sun Mar 27, 2011 9:32 am; edited 1 time in total

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Centurion date

Post  soundhar on Thu Mar 24, 2011 3:19 pm

Another one easiest way

DATE1=DATE2-19000000 WHERE DATE2 = 20110324

SO DATE1 WILL HAVE 1110324

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Centurion date

Post  soundhar on Sun Mar 27, 2011 9:37 am

Centurion date is calculated as
-->
1940 to 1999 = 0
and
2000 to 2039 = 1

regards
Soundhar Smile

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Centurion date

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum