How to convert a Decimal value to Datetime?

2

Can anyone help me with the following question?

I have two return variables. Examples:

  • 1st - type decimal ( vdecTotalHoras ) and a
  • 2nd - also of type decimal ( vdecMediaAnalise ), both return date and time values in decimal . How do I convert to DateTime ?

The code below shows how I'm getting the values:

(
    decTotalHoras = ((paintHoras * 60) + paintMinutos) / 60;
    decMediaAnalise = (decTotalHoras) / paintAnalises;
)

But I can not convert the returns to Hour / Minute / Second.

    
asked by anonymous 04.08.2015 / 17:24

1 answer

0

I think what would make the most sense is the conversion to a Time span ( TimeSpan ). If so, you can use the following snippet:

TimeSpan.FromHours(Convert.ToDouble(decimalValue));

Otherwise you can try the following:

Convert.ToDateTime(decimalValue);

But I never used the second form and I do not know how it would behave.

    
04.08.2015 / 19:34