ABAP有关日期的函数

1、年月日相加減
Date +/- year/month/day (into the future/past)
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = l_date
days = '00'
months = p_month
signum = '-'
years = '00'
IMPORTING
calc_date = l_date.
date为输入的日期,months要加或减的月份,也可以用days or years,signum

2、得到本日是第几周
Returns week for a date
*---&gt get week number
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = in_budat
IMPORTING
week = l_week
EXCEPTIONS
date_invalid = 1
OTHERS = 2.

3、得到本周的第一天
Return first day for a week
*---&gt get first day of week
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week = l_week
IMPORTING
date = it_week-week_dt
EXCEPTIONS
week_invalid = 1
OTHERS = 2.

4、得到本日是本星期的第几天
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = p_date1
IMPORTING
wotnr = l_day.

5、Check 输入日期是否正确
Date plausibility check
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = it_excel-redat
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
it_err-ecode = '10'.
it_err-evalue = it_excel-redat.
it_err-ereason = 'Release Date is not valid'.
APPEND it_err.
endif.

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16565567/viewspace-612657/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16565567/viewspace-612657/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值