Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding system time format

former_member242166
Participant
0 Likes
779

Hi ABAP Experts,

I want system time . I am using sy-uzeit  for getting system time. Its printing like 14:56:42.   But I want show as 2.56 P.M .  How can i achieve this.

Please Guide me.

Thanks and Regards,

Linganathan.K

5 REPLIES 5
Read only

former_member193464
Contributor
0 Likes
724

Hi

     You can use F.M.  HRVE_CONVERT_TIME

Pass time_type = 'A' .

        input_time = sy-uzeit.

and you will get your desired result in output_time and output_am_pm.

Hope this helps.

Read only

0 Likes
724

dear Maverick,

Can you please send any sample code.

Regards,

Linganathan

Read only

0 Likes
724

DATA: lv_time TYPE sy-uzeit,
      lv_am_pm TYPE char2.

       lv_time = sy-uzeit.

CALL FUNCTION 'HRVE_CONVERT_TIME'
  EXPORTING
    type_time             = 'A'
    input_time            = lv_time
*   INPUT_AM_PM           = 'AM'
IMPORTING
   OUTPUT_TIME           = lv_time
   OUTPUT_AM_PM          = lv_am_pm
EXCEPTIONS
   PARAMETER_ERROR       = 1
   OTHERS                = 2
          .
IF sy-subrc EQ 0.
WRITE:/ lv_time, lv_am_pm.
ENDIF.

You can also make a variable type string and concatenate  lv_time and lv_am_pm if you want to use it combined.

Read only

satyabrata_sahoo3
Contributor
0 Likes
724

Use FM HRVE_CONVERT_TIME .

CALL FUNCTION 'HRVE_CONVERT_TIME'

   EXPORTING

     type_time             =  'A'

     input_time            = sy-uzeit

IMPORTING

   OUTPUT_TIME           =  <Time>

    OUTPUT_AM_PM          = <AM/PM Value>

CONCATENATE the two importing parameter to get the exact value.

Read only

ThomasZloch
Active Contributor
0 Likes
724

Virtually everything around date or time formatting has been discussed before. Please make sure you look for available information before posting.

Un-marking this as question.

Thomas