I am new to Planet Press and I am having an issue getting a future date that is three days in adance of the date the document is printed.
First I downloaded the PP Talk Date Library from the website and went to Global Function Libarary Manager and pointed to the directory of this download. I see all the new functions but I thought this would be added to this Talk Editor menu?
Either way, I added the AddDaysToDate Function and this is where I am currently stuck. I do know know what is needed from here to get a simple date that is a few days out on my screen.
What I assume is I need a planet press talk object and it somehow has to reference this function.
The function is as follows.
function @AddDaysToDate(&Date:Date,&DateFormat:MMDDYYYY,&DaysToAdd:): string
%-----------------------------------------------------------
% Function that adds a number of days to a given date. -
%-----------------------------------------------------------
% Input: &Date Date. -
% &DateFormat Format of the date. Use -
% "DD" for day, "MM" for month and -
% "YY" or "YYYY" for year. -
% &DaysToAdd Number of days to add (use -X to -
% substract days). -
% Output: Calculdated date. -
% Uses: NormalizeDate(), DaysInMonth(), FormatShortDate()-
%-----------------------------------------------------------
% Written by: Marty Jacques, Objectif Lune -
% Last updated: February 9, 2005 -
%-----------------------------------------------------------
define(&sResult,string,'')
&Date:=@NormalizeDate(&Date,&DateFormat)
if(mid(&Date,1,1)<>'*')
define(&Day,integer,StrToInt(mid(&Date,1,2)))
define(&Month,integer,StrToInt(mid(&Date,3,2)))
define(&Year,integer,StrToInt(mid(&Date,5,4)))
define(&MonthDays,integer,@DaysInMonth(&Month,&Year))
define(&DayCount,integer,0)
if(&DaysToAdd>0)
repeat
&DayCount:=&DayCount+1
&Day:=&Day+1
if(&Day>&MonthDays)
&Month:=&Month+1
&Day:=1
if(&Month>12)
&Year:=&Year+1
&Month:=1
endif
&MonthDays:=@DaysInMonth(&Month,&Year)
endif
until(&DayCount=&DaysToAdd)
endif
if(&DaysToAdd<0)
repeat
&DayCount:=&DayCount+1
&Day:=&Day-1
if(&Day<1)
&Month:=&Month-1
if(&Month<1)
&Year:=&Year-1
&Month:=12
endif
&MonthDays:=@DaysInMonth(&Month,&Year)
&Day:=&MonthDays
endif
until(neg(&DayCount)=&DaysToAdd)
endif
&sResult:=right('00'+IntToStr(&Day),2)
&sResult:=&sResult+right('00'+IntToStr(&Month),2)
&sResult:=&sResult+IntToStr(&Year)
&sResult:=@FormatShortDate(&sResult,'DDMMYYYY',&DateFormat)
elseif
&sResult:=&Date
endif
&result:=&sResult
endfunction()