You need to sign in to do that
Don't have an account?
Swamy P
How to convert minutes into hours and days by apex
Hello Team,
We were facing an issue on converting minutes into hours and days. The requirement is like when we have 1520minutes, result must show like 1day1hr20minutes.
Usually to convert minutes to hours we will divide by 60. Can anyone help me on showing this result by apex?
Thanks in advance!!
We were facing an issue on converting minutes into hours and days. The requirement is like when we have 1520minutes, result must show like 1day1hr20minutes.
Usually to convert minutes to hours we will divide by 60. Can anyone help me on showing this result by apex?
Thanks in advance!!
integer days = mns / 60 / 24 ;
integer hours = (mns - days * 60 * 24) / 60 ;
integer mins = mns - days * 60 * 24 - hours * 60 ;
String timeSpentOnCase = days+'Days '+hours+'Hours '+mins+'Minutes';
All Answers
integer days = mns / 60 / 24 ;
integer hours = (mns - days * 60 * 24) / 60 ;
integer mins = mns - days * 60 * 24 - hours * 60 ;
String timeSpentOnCase = days+'Days '+hours+'Hours '+mins+'Minutes';