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

Time Format HH:MM:SS

Former Member
0 Likes
22,877

Hi,

I am having a filed of type TIMS, I want to convert and out put that as HH:MM:SS,

Please let me know .

Regards,

Irfan Hussain

8 REPLIES 8
Read only

Former Member
0 Likes
6,534

HI,

use the WRITE statement..

DATA: V_CHAR(8).

WRITE: SY-UZEIT TO V_CHAR.

WRITE: / V_CHAR.

Thanks,

Naren

Read only

former_member186741
Active Contributor
6,534

a tims type field is held internally as hhmmss but will appear if written as hh:mm:ss. You should not have to do any conversion.

Read only

0 Likes
6,534
DATA : MYTIME(8) TYPE C.
DATA : T1 TYPE SY-UZEIT.


*--------------------------------
MYTIME = '06,45,00'.
WRITE :/ 'BEFORE ' , MYTIME.
REPLACE ALL OCCURRENCES OF ',' IN MYTIME WITH ''.
T1 = MYTIME.
WRITE :/ 'AFTER ' , T1.
Read only

0 Likes
6,534

Hi Neil,

It is stored in the data base table as HHMMSS, but i need to display it as HH:MM:SS in the out put.

Please help.

Regards,

Irfan Hussain

Read only

6,534

eg,

DATA TIME TYPE T VALUE '154633'.

WRITE (8) TIME USING EDIT MASK '__:__:__'. "Output: 15:46:33

Read only

Former Member
0 Likes
6,534

take a varible as v_char(8).

Now, as time is stored in TIMS variable in format HHMMSS.

concatenate tims0(2) ':' tims2(2) ':' tims+4(2) into v_char.

Write:/ v_char

Output is displayed as HH:MM:SS

Read only

Triantafillos_p
Explorer
0 Likes
6,534

as @juergen.ette said https://answers.sap.com/answers/11686564/view.html at an older post, you can use CL_ABAP_TIMEFM=>CONV_TIME_EXT_TO_INT/CONV_TIME_INT_TO_EXT

Read only

ab_dogan
Explorer
0 Likes
6,534

Hi, maybe that be a solution for you.

|{ tim(2) }:{ tim+2(2) }:{ tim+4(2) }|.