473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Convert integer to time

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

Glenn
Nov 17 '05 #1
3 33584
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]
- mv*@spam.guard.caspershouse.com

"glenn h" <g_hafstrom@hotmail dot com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
I have i time in Integer = 37825 , how can I convert it in C# to Timeformat
= 10:30:25

Glenn

Nov 17 '05 #2
glenn h <g_hafstrom@hotmail> wrote:
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);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3
Thanks for a quick answer Nicholas!

It works perfect.

Regards
Glenn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uQ**************@TK2MSFTNGP15.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"glenn h" <g_hafstrom@hotmail dot com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
I have i time in Integer = 37825 , how can I convert it in C# to Timeformat = 10:30:25

Glenn


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec(...
7
by: henrytcy | last post by:
Hi, How can I convert integer, for example 12113, to char array but without specify an array size in C programming? Thanks!
1
by: XML newbie: Urgent pls help! | last post by:
How to Convert local time(eg EST) on local machine to GMT. I am using VB.Net 2005. Then I need to subtract 1 minute(or 1-100) minute selected by the user in the combobox and pass it as start...
2
by: Salim Afsar | last post by:
Hi, My web server is not my country, so server's time and my country time is different. So code runs on server, for example when I run DateTime.Now() function it returns server time but I want...
1
by: okaymy1112 | last post by:
I have data in this format 0800, 1730, 0930, etc. I do not know how to convert this time to read something like, 8:00AM, 5:30 PM, 9:30AM etc. Also I want to group things by day. I have courses...
2
karthickbabu
by: karthickbabu | last post by:
Hi In my application i want to convert integer to decimal. I get a input and using convert function to convert into decimal. But it shows as it self. My code like as below, Is any wrong in...
4
by: mthread | last post by:
Hi, I would like to know the method to convert integer to string. Thanx in advance.
6
by: ngajay | last post by:
Please tell me... how to convert integer to hex in little endian format ? example : i'm input int = 9995 then the output in Array String is
2
by: pantherxin | last post by:
Writing program to calculate cir., area, etc. of circle. Radius is input as integer; how to convert integer to proceed with calculations?
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.