Abap中的日期格式的处理

*&---------------------------------------------------------------------*
*& Report z_other_data_types.
*&---------------------------------------------------------------------*
*& Author: KF041
*&
*&---------------------------------------------------------------------*
REPORT z_other_data_types.


DATA: my_date1   TYPE d VALUE '20221206',
      my_date2   LIKE sy-datum,
      my_time1   TYPE t VALUE '111213',
      my_time2   LIKE sy-uzeit,
      empl_sdate TYPE d VALUE '20121206',
      empl_edate LIKE empl_sdate,
      los        TYPE i,
      days_count TYPE i,
      fur_date   TYPE d.

empl_edate = sy-datum.

los = empl_edate - empl_sdate.

WRITE los.
ULINE.
days_count = 30.
fur_date = empl_edate + days_count.
WRITE / fur_date.

ULINE.
WRITE: / my_date1,
       / my_date2,
       / my_time1,
       / my_time2.

empl_edate = sy-datum. "当前日期
empl_edate+6(2) = '01'. "将日期调整本月第一天最后两位
empl_edate -= 1. "则上月最后一天为当月第一天减1

WRITE empl_edate.