Convert integer to time

  • Thread starter Thread starter glenn h
  • Start date Start date
G

glenn h

I have i time in Integer = 37825 , how can I convert it in C# to Timeformat
= 10:30:25

Glenn
 
Glenn,

Use the static FromSeconds method on the TimeSpan structure to convert
the number of seconds to a TimeSpan.

Hope this helps.
 
glenn h said:
I have i time in Integer = 37825 , how can I convert it in C# to Timeformat
= 10:30:25

I assume the integer is meant to be seconds since midnight?

The easiest thing to do would be something like:

DateTime time = Date.Today + new TimeSpan (0, 0, seconds);
 
Thanks for a quick answer Nicholas!

It works perfect.

Regards
Glenn





Nicholas Paldino said:
Glenn,

Use the static FromSeconds method on the TimeSpan structure to convert
the number of seconds to a TimeSpan.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

glenn h said:
I have i time in Integer = 37825 , how can I convert it in C# to Timeformat
= 10:30:25

Glenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top