SAP 计算时间-MTIME

计算时间字段的值,例如Structure EMG_FILEINFO 中的字段 MTIME,字段描述:Last modification: seconds since 1970.

SAP include LEMIG_LISTF01
form GET_DAT_TIME

form get_dat_time using    p_mtime
                           p_date
                           p_time.

  tables: ttzr, ttzz.

  data: tage type i,
        seku type i,
        uzeit type t,
        sdatum type d value '19700101',
        tzone like ttzdata-tzone.

  tage = p_mtime div 86400.
  seku = p_mtime mod 86400.
  p_date = sdatum + tage.

  if ttzz is initial.
    call function 'TZ_LOCATION_TIMEZONE'
         exporting
              country           = 'DE'
         importing
              timezone          = tzone
         exceptions
              no_timezone_found = 1
              others            = 2.

    select single * from ttzz where tzone eq tzone.
    select single * from ttzr where zonerule eq ttzz-zonerule.
  endif.

  if ttzr-utcsign eq '+'.
    uzeit = seku + ttzr-utcdiff.
  else.
    uzeit = seku - ttzr-utcdiff.
  endif.

  p_time = uzeit.


endform.                               " GET_DAT_TIME

你可能感兴趣的:(time)