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 displaying problem

Former Member
0 Likes
1,300

Hi all,

I have a variable which has a value 1773614, where 177 is hours, 36 is minutes and 14 is seconds. I want it to be displayed as 177:36:14 format. How can i do it?. Please give me an example or a code.

Regards,

John

11 REPLIES 11
Read only

Former Member
0 Likes
1,098

data: b(9) type c.
data: b(7) type c.

a = '1773614'.

concatenate a(3) ':' a+3(2) ':' a+5(2) into b.

so b = 177:36:14

Reg,

Sachin

Read only

Former Member
0 Likes
1,098

Hi,

Use the following logic.


data : l_time(10) type c.

l_time = '1773614'.

write : l_time using edit mask '___:__:__' .

Read only

Former Member
0 Likes
1,098

hey,

if always first3 charz hours and then 2 mins and then 2 seconds

lv_hours = lv_num+0(3)

lv_mins = lv_num+4(2)

lv_sec = lv_num+5(2)

concatenate lv_hours lv_mins lv_sec into lv_num seperated by ':'.

reg

Read only

Former Member
0 Likes
1,098

Hi,

concatenate sy-uzeit sys field into new field .

So for this format you have to take variable of char type and 8 length .

data : v_time(8) .

CONCATENATE SY-UZEIT+0(2) ' : ' SY-UZEIT+2(2) ' : ' SY-UZEIT+4(2) INTO V_TIME .
WRITE : V_TIME .

Thanks

Shrila

Read only

Former Member
0 Likes
1,098

try like this..


DATA: time TYPE char9 VALUE '1773614' .
WRITE: time USING EDIT MASK '___:__:__'.

Read only

Former Member
0 Likes
1,098

Hi John,

Kindly go through this link below:

Hope it helps

Regards

Mansi

Read only

Former Member
0 Likes
1,098

Hi,

this can be achieved by below code:

data:

w_time(10) value '1772525'.

write / w_time using edit mask '___:__:__'.

regards,

sankar

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,098

Hi,

You can use FM CONVERT_TIME_INPUT.

Please close the question if answered.

Regards,

Tarun

Read only

Peranandam
Contributor
0 Likes
1,098

Hi John,

Try this.

data: v_var type char3,

v_var1 type char2,

v_var2 type char2,

v_result type char9,

v_input type char 6.

v_input = '1773614'.

v_var = v_input(3).

v_var1 = v_input(3).

v_var2 = v_input(3).

CONCATENATE v_var v_var1 v_var2 into v_result seperated bt ':'.

Regards,

Peranandam

Read only

Former Member
0 Likes
1,098

Hi,

This is simple simply use the concatenate and the offset functionality:

data: num(7) type c value '1773614',
num1(3) type c,
num2(2) type c.


num1 = num+0(3).
num2 = num+3(2).
concatenate num1 ':' num2 ':' num into num.

write:/ num.

OR

use the FM CONVERT_TIME_INPUT

or

use the EDIT MASK in the write statement to display the output as per the requirement.

Press F1 on write statement for various alternatives in write statement.

Hope this might help you out.

Pooja

Edited by: Pooja Gupta on Mar 16, 2009 11:26 AM

Read only

Former Member
0 Likes
1,098

Hi,

You just try the below FM

TIME_CHAR_CONVERSION

Regards,

Anki Reddy