SAP 时间戳获取及使用函数

  • A+
所属分类:Notes

时间戳是长度 15的 DEC类型,组成为 8位日期 + 6位时间。

时间戳与时间的转化:

把时间和日期转成时间戳

CONVERT DATE IV_DATE TIME IV_TIME
INTO TIME STAMP EV_TIMESTAMP
TIME ZONE SY-ZONLO.

已经封装的函数为:

CALL FUNCTION 'CIF_GEN4_CONVERT_DATETIME'
EXPORTING
iv_date = l_datum1
IV_TIME = l_time1
IV_TIMEZONE = SY-ZONLO
IMPORTING
EV_TIMESTAMP = l_timestamp1
EXCEPTIONS
TIME_CONVERSION_FAILED = 1
OTHERS = 2
.

把时间戳转成日期时间:

CONVERT TIME STAMP IV_TIMESTAMP
TIME ZONE LV_UTCZONE
INTO DATE EV_DATE
TIME EV_TIME.

已经封装的函数为:

CALL FUNCTION 'CIF_GEN4_CONVERT_TIMESTAMP'
EXPORTING
iv_timestamp = l_timestamp3
IV_TIMEZONE = SY-ZONLO
IMPORTING
EV_DATE = l_datum3
EV_TIME = l_time3
EXCEPTIONS
TIME_CONVERSION_FAILED = 1
OTHERS = 2

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: