Conversion

  • Thread starter Thread starter Aris
  • Start date Start date
A

Aris

How can i convert a decimal tha represents seconds

decimal a = 1267.907;

to hours, minutes and seconds (hh:mm:ss)?

Thanks
 
You can construct a DateTime object using the following constructor:
public DateTime(long ticks), with ticks being a date and time expressed in
100-nanosecond units.

So, what you can do to convert your decimal is the following:

decimal a = 1267.907M;
DateTime dt = new DateTime(Convert.ToInt64(a * 1E7M));
 
Back
Top