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: 

Need function to convert Time period

Former Member
0 Kudos

Hi,

I have a data where time is displayed in HH:MM format. Is there any function which can read the in separate Hour and minutes so as to convert into number of days?

6 REPLIES 6

former_member198275
Active Contributor
0 Kudos

can u Explain it with exalple..

former_member188827
Active Contributor
0 Kudos

divide the MM portion by 60 and add to HH portion.u'll get total no of hours..den use da simple logic:

no. of days =(1/24) * total hours

plz reward points if it helps

Former Member
0 Kudos

Hi Nilesh,

let is say your variable is l_time which holds time in the format of HH:MM.

save this l_time to some variable of numerical character type first,

then get the hours and minutes into seperate variables like shown below,

l_char_time = l_time.

l_hours = l_char_time+0(2).

l_min = l_char_time+2(2).

number_of_days = ( l_hours + ( l_min / 60 ) ) / 24.

there you have the number of days,

Note: l_hours, l_min, number_of_days & l_char_time are of type N.

<b>Reward points if this helps,</b>

Kiran

Former Member
0 Kudos

Hi,

can you give more explation of ur reqr........

u want to conver the number of hours to days ?

Regards,

Vijay

0 Kudos

Hi let me explain the requirment

Data is say 30 : 20 i.e 30 hours and 20 minutes.

I need to separate 30 and 20. Convert it into either minutes as 30*60 +20

or in hours 30 + 20/60 = 30.33 Hrs.

How could I separate this two?

0 Kudos

move ztime to zchar.

split zchar at ':' into zstr1 zstr2.

replace ':' in zstr1 with space.

zint1 = zstr1.

zint2 = zstr2.

den carry out calculations on zint1 and zint2.

plz reward points if it helps