SAP提供了一个标准函数SALP_SM_CALC_TIME_DIFFERENCE,用来计算两个日期时间之间差多少秒.
SE37测试:
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
REPORT ZTEST_DIFF_SECONDS. data:l_data1 type d, l_time1 type t, l_data2 type d, l_time2 type t, l_sec type i. l_data1 = '20170101'. l_data2 = '20170102'. l_time1 = '010102'. l_time2 = '031102'. CALL FUNCTION 'SALP_SM_CALC_TIME_DIFFERENCE' EXPORTING date_1 = l_data1 time_1 = l_time1 date_2 = l_data2 time_2 = l_time2 IMPORTING SECONDS = l_sec . WRITE:l_sec . |
以上。
发表评论