T.R | Title | User | Personal Name | Date | Lines |
---|
470.1 | try AYMD subr. | MLCADG::FERRARIF | | Tue Oct 15 1991 06:32 | 29 |
|
Hi John,
you can use the subroutines 'AYMD'.
AYMD (indate, days, outfield)
indate: numeric - input date in format year-month-day.
if date is not valid the subr, returns 0.
days : numeric - number of day to sum. use negative
number to subtract days.
outfield : integer - name of field containing the result
date.
example:
---> add 30 days to 'DATE'
TABLE FILE yourfile
PRINT FIELD1 DATE AND COMPUTE
AFTER30DAYS/I6YMD = AYMD (DATE, 30, AFTER30DAYS);
BY NAME
END
Hope this help
Fabio.
|
470.2 | | AIMHI::CIONI_L | | Tue Oct 15 1991 12:18 | 22 |
|
With Version 5.2 and above of FOCUS, FOCUS supports a set of new date formats
designd to make date manipulation easier.
Included in this is the ability to simply add a number of days to a date field.
PLUS_DATE/I6YMD = YOUR_DATE + 30;
Other things included:
Sorting dates regardless of display format
Defining date components such as year and month or quarter and extract-
ing them easily from the date fields.
Doing arithmetic with dates and date comparisons without resorting to
special date handling functions.
Converting dates easily to other formats.
FYI.
LisaC
|
470.3 | Using -SET | MISERY::BLUM_JO | | Tue Oct 15 1991 15:30 | 9 |
| Thanks Fabio and Lisa. What I'm really looking for is a way to
-SET a variable as follows:
-SET &BEGIN_DATE = &DATE +21;
-SET &END_DATE = &DATE +26;
Any ideas on how to get this to work?
John
|
470.4 | same subr. | MLCADG::FERRARIF | | Wed Oct 16 1991 06:21 | 9 |
|
Try this:
-SET &&NEWDATE = 0;
-SET &&NEWDATE = AYMD (&OLDDATE, 30, 'I6');
-RUN
Ciao
Fabio.
|
470.5 | related to .-1 | MLCADG::FERRARIF | | Wed Oct 16 1991 06:27 | 14 |
|
P.S.
just to clarify,
&olddate is your date in format YYMMDD
30 is number of days to add
'I6' is the format of &&newdate (use quotation mark)
youdon't need to user && but can also be only &.
Regards
Fabio.
|
470.6 | AYMD subroutine | MISERY::BLUM_JO | | Wed Oct 16 1991 16:41 | 17 |
| Thanks Fabio.
I tried using the subroutine AYMD, but didn't have the apostrophies
with the outfield (the documentation gives no indication apostrophies
are required). Also, I had to use the correct date variable (&YMD
instead of &DATE).
The field I'm screening for is the RVS_CMMT_DT in the Backlog database,
which has a format of A6YMTD. The correct -SET commands are:
-SET &BEGIN_DATE = AYMD (&YMD, 21, 'I6YMD');
-SET &END_DATE = AYMD (&YMD, 26, 'I6YMD');
Regards,
John
|
470.8 | Substraction of days | UTROP1::WOUW_F | Love is a many sp(l)ended thing | Wed Oct 23 1991 07:39 | 43 |
| Hi there,
As I'm trying to substract days from today's date, I end up,
sometimes, with a result of 1991/10/00.
Please let me put the define statement I use in this topic, perhaps
some of you can provide my with I much better routine.
Thanks in advance,
Fons van de Wouw.
DEFINE FILE ORDERS
TODAY/I8YYMD = &YMD + 19000000;
YESTERDAY/I8YYMD = (TODAY - 23);
CHECK/I8YYMD = IF YESTERDAY EQ 19910100 THEN 19911231 ELSE
IF YESTERDAY EQ 19910200 THEN 19910131 ELSE
IF YESTERDAY EQ 19910300 THEN 19910228 ELSE
IF YESTERDAY EQ 19910400 THEN 19910331 ELSE
IF YESTERDAY EQ 19910500 THEN 19910430 ELSE
IF YESTERDAY EQ 19910600 THEN 19910531 ELSE
IF YESTERDAY EQ 19910700 THEN 19910630 ELSE
IF YESTERDAY EQ 19910800 THEN 19910731 ELSE
IF YESTERDAY EQ 19910900 THEN 19910831 ELSE
IF YESTERDAY EQ 19911000 THEN 19910930 ELSE
IF YESTERDAY EQ 19911100 THEN 19911031 ELSE
IF YESTERDAY EQ 19911200 THEN 19911130 ELSE
YESTERDAY;
ORST_ODT_H/I8YYMD = (EDIT(EDIT(ORST_ODT_H,'99999999')));
DIF/I4 = YMD(CHECK,ORST_ODT_H);
END
TABLE FILE ORDERS
PRINT
DECNO
ORST_ODT_H
IF SRC_SYS_CD EQ 'COMAND'
IF DIF GE '0'
HEADING CENTER
"Today is <TODAY and Yesterday is was <YESTERDAY but should be <CHECK "
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</2"
ON TABLE HOLD AS DATE1 FORMAT DOC
END
|
470.9 | make your choice | MLCADG::FERRARIF | | Thu Oct 24 1991 06:50 | 45 |
|
Hi,
you can use one of the following:
1) see .1
2) a bit complicated
DEFINE FILE ORDERS
...
TODAY/I6= &YMD;
GGARR/I6=DAYMD (TODAY, 'I6');
GGARR=GGARR - 23;
YESTERDAY/I6=DTYMD (GGARR,'I6');
YESTERDAY2/I8=YESTERDAY + 19000000;
...
END
-*
TODAY = is the date of today in format YYMMDD
GGARR = convert date (this century) into number of days,
from 01-jan-1900 to 'today', obtained using subr DAYMD
GGARR=GGARR-23 = subtract 23 days form number of days ...
YESTERDAY = convert number of days into date (this century) in
format YYMMDD
YESTERDAY2 = obtain date in format YYYYMMDD
3) very simple
DEFINE FILE ORDERS
...
TODAY/I6YMD = &YMD;
YESTERDAY/I6= TODAY - 23;
YESTERDAY2/I8 = YESTERDAY + 19000000;
...
END
Ciao
Fabio.
|