Convert date to local timezone

Convert date to local timezone

Check code example below :

  DATA : lw_timestamp     TYPE timestamp,
         lw_date_syst     TYPE datum,
         lw_time_syst     TYPE uzeit,
         lw_date_local    TYPE datum,
         lw_time_local    TYPE uzeit,
         lw_syst_timezone TYPE tznzone.

  " Retrieve system timezone
  " ------------------------
  SELECT SINGLE tzonesys
       FROM ttzcu
       INTO lw_syst_timezone.

  " Convert date / time to system timestamp
  " ---------------------------------------
  CONVERT DATE lw_date_syst
          TIME lw_time_syst
          DAYLIGHT SAVING TIME 'X'           " Manage summer/winter time
          INTO TIME STAMP lw_timestamp
          TIME ZONE lw_syst_timezone.

  " Convert timestamp to local date/time
  " ------------------------------------
  CONVERT TIME STAMP lw_timestamp TIME ZONE sy-zonlo
  INTO DATE lw_date_local
       TIME lw_time_local.

Search tag: fuseau horaire, heure, convertir,

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV :

Leave a Reply