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: 

Convert :- Minutes to Days:Hours:Minutes

Former Member

Hi Friends ,

I want to convert the time value from MINUTE to HH : MM : SS

I mean in input i have to pass 200 Minutes and in Output i want to get the no of hr and minutes in the format 03 : 20 ( HH:MM) . I have used the FM "CONVERSION_EXIT_SDURA_OUTPUT" for this .

This works fine for time input values upto 5 digits like ( 20000 minutes) = 333:20 (HH:MM) ,

when the input value is more than 5 digits , ex - 200000 this FM does not work .

Is there any FM where i can get the conversion from MINUTE to HH :MM:SS or from Minutes to DAYS :HPURS:MINUTES .

I have searched SDN , but i dint get the exact FM which i want ,

If any body has any idea on the same please guide me on the same .

Regards

Parbhudutta

1 ACCEPTED SOLUTION

Former Member

hi

just try this fm MONI_TIME_CONVERT.

alternately what you can do is that you just convert the seconds to a type p variable and then assign it to a variable like sy-uzeit.

hope it helps

regards

Aakash Banga

12 REPLIES 12

former_member585060
Active Contributor
0 Kudos

Hi,

Try this FM "OIJ_LT_CONVERT_TIME".

Regards

Bala Krishna

0 Kudos

Thanks.

The FM OIJ_LT_CONVERT_TIME really helps to get theseconds in DAYSHOURS .

Regards

Prabhudutta

0 Kudos

Resolved ,

Thanks for all of your inputs .

Regards

Prabhudutta

Former Member
0 Kudos

Hi,

You can even try OIRE_CONVERT_TIME_240000.

Regards,

Nimish

former_member226203
Active Contributor
0 Kudos

Hi,

Not sure of the FM. But i think you can use the following logic:

Parameters P_var(10) type c.

data: v_val type string.

data: v_val1 type string.

data: v_val2 type string.

v_val = p_var div 60.

v_val1 = p_var mod 60.

concatenate v_val ':' v_val1 into v_val2.

write:/ v_val2.

hope this is helpful.

Regards,

Kalyan.

Former Member

hi

just try this fm MONI_TIME_CONVERT.

alternately what you can do is that you just convert the seconds to a type p variable and then assign it to a variable like sy-uzeit.

hope it helps

regards

Aakash Banga

0 Kudos

Thanks all for all of your valuable inputs .

IBy using FM : MONI_TIME_CONVERT , i am able to get HH:MM:SS format data by giving input as seconds .

But the issues i have is , i have data as input in seconds which is noear to a 10 digit number like

200000000 seconds , which does not work for this FM .

I have input data in MINUTES which is near to 10 digit , exmp - 239879798 minutes . So i want to convert this no to ( DAYS : HOURS : MINUTES : SECONDS )

Other FMs that has been given by you guys i have checked but i am not able to get exactly what i want .

Anyway thanks again .

Reagards

Prabhudutta

0 Kudos

Hi Aakash,

how can we use this FM for a CDS view??

Regards,
Supriya

Former Member
0 Kudos

hi Parbhudutta

better create Z function module :ZCONVERSION_EXIT_SDURA_OUTPUT

and write condition like this

If hours LT 20000.

write hours to output(3) no-sign.

output+3(1) = ':'.

write minutes_n to output+4(2).

endif .

if hours GT 20000.

write hours to output(4) no-sign.

output+4(1) = ':'.

write minutes_n to output+5(2).

endif .

i hope this will work .

with regards

kota narasimha rao

Former Member
0 Kudos

Hi,

Hope below FM helpful to you.

CIF_GEN3_CONVERT_DATETIME

CIF_GEN3_CONVERT_TIMESTAMP

CIF_GEN_CONVERT_DATETIME

CIF_GEN_CONVERT_TIMESTAMP

CONVERT_TIME_TERMS

FCOM_EQM_CONVERT_TIME_FRAME

FRE_CONVERT_DATE_2_TIMESTAMP

FRE_CONVERT_TIMESTAMP_2_DATE

Regards

Durga

Former Member
0 Kudos

You can do it in simple way

Hours = Minutes /60

Minute = Minutes mod 60

output is Hours : Munute

Regards

Sasi

Former Member
0 Kudos

u can try as below also.

function MinutesToDaysHoursMinutes(AMinutes: Integer): string;

const

HOURSPERDAY = 8; // wieviele Stunden hat der Tag? (Beispiel hier: 1 Arbeitstag)

var

Days: Integer;

Hours: Integer;

Minutes: Integer;

begin

if (AMinutes > 0) then

begin

Hours := AMinutes div 60;

Minutes := AMinutes mod 60;

Days := Hours div HOURSPERDAY;

Hours := Hours mod HOURSPERDAY;

end

else

begin

Hours := 0;

Minutes := 0;

Days := 0;

end;

Result := Format('%.2d:%.2d:%.2d', [Days, Hours, Minutes]);

end;