Application Development 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: 

Time Format HH:MM:SS

Former Member
0 Kudos

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

Former Member
0 Kudos

HI,

use the WRITE statement..

DATA: V_CHAR(8).

WRITE: SY-UZEIT TO V_CHAR.

WRITE: / V_CHAR.

Thanks,

Naren

former_member186741
Active Contributor

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.

0 Kudos
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.

0 Kudos

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

eg,

DATA TIME TYPE T VALUE '154633'.

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

Former Member
0 Kudos

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

Triantafillos_p
Explorer
0 Kudos

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

ab_dogan
Discoverer
0 Kudos

Hi, maybe that be a solution for you.

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