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.
Showing results for 
Search instead for 
Did you mean: 

Change minutes in data type T

Former Member
0 Kudos

Hi All,

Is there any FM to convert minutes into time format.

For example i have 103.8 i.e 103 minutes and 8 seconds and i wanna have as 01:43.80.



Former Member
0 Kudos

Hi Aima,

You can use FM C14Z_CALC_DATE_TIME to get the time.

But ,the input to this function module is time(in Seconds (so, u need to get time in seconds)), Date and current time...

For eg:

Import Parameters Value


I_UZEIT 00:01:30

I_DATUM 06.12.2005

After running the FM with above inputs, we get,

Export parameters Value

E_DATUM 06.12.2005

E_UZEIT 00:04:35



0 Kudos

Hi Rajesekhar,

i have given the FM C14Z_CALC_DATE_TIME but system gives me status mssg there is no such FM, i am working on 4.6c

Thanks for ur reply.


Former Member
0 Kudos


There is no FM to do this. But the option is as follows.

Declare v1, v2, v3, v4, v5

split time into v1 v2 at '.'.

v3 = v1 / 60.

v4 = v1 - (v3*60).

concatenate v3 v4 into v5 separated by ':'.

concatenate v5 v2 into time separated by '.'.

use this time.

Hope this solves ur problem.

Pl. award appropriate points.

Former Member
0 Kudos

Hi Aima,

That FM is available in Enterprise edition...

Then do one thing...

Take integer part and fraction part of your time...

With integer part, use mod and div operations to get hours and minutes...

Then add fraction part the time...

You need to do by code i believe... in 4.6C



Former Member
0 Kudos


could not find any function module....

here is a very crude logic for this purpose (from a type p variable initially)

please help yourself in improving this logic in terms of performance.....:-)

DATA tm1 TYPE p VALUE '103.84' DECIMALS 2.

DATA : v_frac TYPE p DECIMALS 2 ,

v_trunc TYPE p DECIMALS 2,

v_str TYPE string,

v_int TYPE i,

v_mod TYPE i,

v_rem TYPE i,

v_mod_hrs TYPE i,

v_rem_hrs TYPE i.

WRITE 😕 'initial : ', tm1.

v_trunc = TRUNC( tm1 ).

v_frac = FRAC( tm1 ).

v_str = v_frac.

v_str = v_str+2(2).

WRITE 😕 'split : ', v_trunc, v_frac.

v_int = v_str.

v_mod = v_int / 60.

v_rem = v_int MOD 60.

WRITE 😕 'from decimals part : ', v_mod, 'minutes', v_rem, 'seconds'.

ADD v_mod TO v_trunc.

WRITE 😕 'new : ', v_trunc, 'minutes', v_rem, 'seconds'.

v_mod_hrs = FLOOR( v_trunc / 60 ).

v_rem_hrs = v_trunc MOD 60.

WRITE 😕 'final : ', v_mod_hrs, 'hours', v_rem_hrs, 'minutes', v_rem, 'seconds'.



Former Member
0 Kudos

Hi aima,

1. something close to ur requirement.

and quite simple.


DATA : mydate TYPE sy-uzeit.

DATA : mysec TYPE i.


mymin = '103.8'.

mysec = mymin * 60.

mydate = mydate + mysec.

WRITE : mydate

3. Bcos Seconds are required, we need * 60.


amit m.

0 Kudos

Hi Amit, i have tried this code....

if hrc < 10.

concatenate '0' hrc into hrc.

condense hrc no-gaps.


<b>converting minutes into seconds and hours into seconds</b>

m = m * dr.

hrc = hrc * 3600.

replace '.' with '' into m.

condense m no-gaps.

hrc = m + hrc .

<b>atm type t. </b>

atm = atm + hrc.

The difference i am getting interms of seconds , i hope it does not matter

Can i get the exact hours.

for exp: number of seconds herr is 3492 which is 005820

but it taking as 005812.

Thanks .

0 Kudos

HI Aima,

Why did you think 3492 secs is not 005812??

3492 secs is definitely, 005812 only and not 005820.

The problem here is, say for example

you have the minutes as 2.50.

What do you mean by 2.5 minutes? is it two amd half minutes or 2 minutes and 50 secs?

It all depends on how you treat the decimal part.



0 Kudos

Hi Ravi,

<b>Why did you think 3492 secs is not 005812??</b>

coz,3492 / 60 = 58.20 and 58.12 * 60 = 3487.2 .

<b>What do you mean by 2.5 minutes? is it two amd half minutes or 2 minutes and 50 secs?</b>

for me it is 150 sec.

i am taking all the variables as Char and then passing them to ATM which is type T.

If i am wrong then plz guide me .


0 Kudos

Hi Aima,

OK If 2.5 minutes mean 15 seconds, then it makes things easier.

You just need to multiply with 60 and pass that to a variable of type T.

Data: t_total_time(8).

total_secs = value * 60. (say value = 2.5)

write: total_secs to t_final_time.

write: t_final_time.

I think you are a bit confuse with the seconds.

Here 58.12 means 58 minutes and 12 seconds.

that means 58 mins + 12/60 minutes

58+ 0.20 = 58.20. (12/60 = 0.20)

In other words, what you think is 0.2 is nothing but 2 tenths of a minute(nothing but 12 secs).

Hope it is clear now.



Active Contributor
0 Kudos

HI aima,

First convert the minutes into time and use

data: lv_new_time(8).

lv_secs = lv_minutes * 60.

write: lv_secs to lv_new_time.

write: lv_new_time.



Former Member
0 Kudos

Hi again,

1. In case of 3492 Seconds,

I think it is absolutely correct.


2. 58 (Minutes) X 60 Seconds = 3480

3. 3492 - 3480 = 12 Seconds.

4. 12 seconds are remaining (and not 20)

(The base is 60 seconds)

( and not 100)

5.I think it is correct.

Or are u trying to say something else.


Amit M.

Former Member
0 Kudos

Hi again,

1. The field will have the format


and it will consider the base of SS as 60

only and not 100

(which is very well justified as per the

standard format of time HH:MM:SS)

2. For your requirement, u will have to

try some home made logic.

3. Extract Seconds SS from the field.

Divide it by 60

eg. 12 / 60 * 100

= 20

4. This way i think needs to be worked.

5. There is no DIRECT way for Base 100.


Amit M.

0 Kudos

Thanks Amit,

Ur answers were quite useful for me to develop the hard code logic .

3. Extract Seconds SS from the field.

Divide it by 60

eg. 12 / 60 * 100

= 20

let me try above code.

Surely would like to assign points for u.