Page 1 of 1

Convert Decimal to Time

Posted: Mon May 23, 2022 10:51 pm
by bani06

Hi,

I have decimal value 2.7. I want to convert this to time format which is suppose to 2.42. Have try using

NETT_SORT_TIME1 = 2.7

(rsnew["NETT_SORT_TIME"])= (TimeSpan.FromHours(rsnew["NETT_SORT_TIME1"]));

but it shows error. How it suppose to change the correct time value?


Re: Convert Decimal to Time

Posted: Tue May 24, 2022 7:42 am
by MichaelG

Try converting the value to integer first. For example:

int val = ConvertToInt(...);