Hi all!
New day new challenge. I have a column in my report that is in hours. Client wants to see in x days, x hours, x minutes
I used this link to http://www-01.ibm.com/support/docview.wss?uid=swg21339322 (http://www-01.ibm.com/support/docview.wss?uid=swg21339322) to help so my data items are as follows:
[Days] : cast((floor([myField]/24)), varchar(10))
[Hours] : cast(floor(([myField]-(floor([myField]/24))*24)), varchar(10))
[Minutes] : cast(([myField]-(floor([myField]/60)*60)), varchar(10))
but I am realizing that it is not pulling a correct result. # days look right, # hours are right but # minutes are off (left the decimals on purpose). It looks like the minutes are just mirroring one number before the decimal point and the decimals. Doesn't look like it is calculating anything.
Anyone as a simpler solution or can tell me whats is wrong with the minutes calculation?
couldn't you do the minutes calculation as ([myField] - ([Days] *24) - [Hours]) * 60 ?
That worked!
Thank you so much! Although now I cannot get rid of the decimals with "floor"
what happens if you try doing the calculation without the cast? What do you get from the following:
Days: floor([myField]/24)
Hours: floor([myField]-floor([myField]/24)*24) or
Hours: floor([myField] - [Days] * 24)
Mintues: ([myField] - ([Days] *24) - [Hours]) * 60
Looks good too but my minutes still have lots of decimals I would like to trim
ETA: forgot my _round...
all good thanks!