Chinaunix首页 | 论坛 | 博客
  • 博客访问: 346133
  • 博文数量: 90
  • 博客积分: 847
  • 博客等级: 准尉
  • 技术积分: 1373
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-02 10:54
个人简介

跌打滚爬中的小菜鸟...

文章分类

全部博文(90)

文章存档

2015年(5)

2013年(47)

2012年(38)

我的朋友

分类: 其他UNIX

2013-09-18 16:02:11

 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).
阅读(1258) | 评论(0) | 转发(0) |
0

上一篇:%date, %time

下一篇:free format COMMIT CONTROL

给主人留下些什么吧!~~