FMT D DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++
*************** Beginning of data **********************
0001.00 D Date1 S D Inz(D'2013-07-18')
0002.00 D Time1 S T Inz(T'10.22.30')
0003.00 D NewDate S D
0004.00 D NewTime S T
0005.00 D Num6 S 6 0
0006.00 D Diff S 6 0
0007.00 D Month S 2 0
0008.00
0009.00 /free
0010.00 Eval NewDate=Date1+%Months(3); //这个函数带S啊
0011.00 Dsply ('NewDate is '+%Char(NewDate));
0012.00
0013.00 Eval NewTime=Time1-%Hours(4); //这个函数带S啊
0014.00 Dsply ('NewTime is '+%Char(NewTime));
0015.00
0016.00 Month=%Subdt(NewDate:*M); //用于从date, time, timestamp中extract 部分信息
0017.00 Dsply ('The Month of NewDate is '+%Char(Month));
0018.00 //*MN表示分钟, 比较两个date, time, timestamp的差距, 指定以分钟为单位
0019.00 Diff=%Diff(Time1:NewTime:*MN);
0020.00 Dsply ('The diff bt Time1 & newTime in Sec is '+%Char(Diff));
0021.00
0022.00
0023.00 Eval *inlr=*on;
0024.00 Return;
0025.00 /end-free
****************** End of data *********************************
%YEARS
%MONTHS
%DAYS
%HOURS
%MINUTES
%SECONDS //这几个built-in函数都是用的复数!!!!
%DIFF (Difference Between Two Date, Time, or Timestamp Values)
%DIFF(op1:op2:*MSECONDS|*SECONDS|*MINUTES|*HOURS|*DAYS|*MONTHS|*YEARS)
%DIFF(op1:op2:*MS|*S|*MN|*H|*D|*M|*Y)
%DIFF produces the difference (duration) between two date or time values. The
first and second parameters must have the same, or compatible types. The
following combinations are possible:
v Date and date
v Time and time
v Timestamp and timestamp
v Date and timestamp (only the date portion of the timestamp is considered)
v Time and timestamp (only the time portion of the timestamp is considered).
阅读(1302) | 评论(0) | 转发(0) |