We usually need float to hours conversion on SSRS reports. Following small code take real as input and convert into hours. it converts decimal value greater than 59 into respect hours and minutes
private Hours realToHours(real hours)
{
real hours = 1.61;
str time;
int secs;
secs = str2Time(strFmt("%1",hours));
time = time2Str(secs, TimeSeparator::Dot, TimeFormat::Hour24);
time = strDel(time,6,3);
info(strFmt("%1",str2num(time)));
}
input hours real = 1.61
output hours = 2.01
input hours real = 0.5
output hours = 0.50
input hours real = 1.60
output hours = 2.00
No comments:
Post a Comment