August 14, 2012, 09:03 AM
Tomsweb[SOLVED] Convert alpha date and time fields for date subtraction
In my master file I have a date field (Recdate) stored as an A6. Recdate: 800801
And there is a time field (Rectime) stored as an A4 Rectime: 0314
In a define I have converted the Recdate field to a I6YMD field and used DATECVT to arrive at the full year w slashes.
quote:
DEFINE FILE MMEXT
IDATE/I6YMD WITH WO = EDIT(RECDATE);
ITIME/I6 WITH WO = EDIT(RECTIME);
DATE2/YYMD = DATECVT(IDATE,'I6YMD','YYMD');
DATE3/A8YYMD = DATE2;
ATDT/A14 = RECDATE || (' ' | RECTIME);
ATDTA/A14 = DATE3 || (' ' | RECTIME);
END
I am trying to concat the recdate and rectime fields together into one variable to subtract it from another date/time field.
I have been away from WF for some time and I am trying to get up to speed without much grief from the alpha date / smart date grind.
Can anyone give me some pointers?
Thanks!
This message has been edited. Last edited by: Tomsweb, August 16, 2012, 02:58 PM
KerryHi Tom,
Glad to see this issue is resolved, would you mind to share your solution please? Thanks in advance.
Cheers,
Kerry
August 17, 2012, 09:02 AM
jgelonaHere's one solution.
DEFINE FILE MACGYVER
ADATE/A6YMD='800801';
ADATE2/A8YYMD=DATECVT(ADATE,'A6YMD','A8YYMD');
ATIME/A4='0314';
ADTTM/A12=ADATE2 | ATIME;
HDATE/HYYMDS=HINPUT(12,ADTTM,8,'HYYMDS');
END
TABLE FILE MACGYVER
PRINT HDATE
IF COUNTER EQ 1
END
produces: 1980/08/01 03:14:00