Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created a stored procedure to convert the hh:mm:ss into seconds. Now for verifying i need to convert the seconds into hh:mm:ss and show it in individual boxes in windows form seperated by colon.i need to perform this using c# kindly guide me in separating these values and show it in windows form by means of c#.

What I have tried:

i converted the seconds into hh:mm:ss i want to know how to separate it and display in the windows form using c#
Posted
Updated 7-Oct-16 1:23am
Comments
Patrice T 7-Oct-16 14:59pm    
And you have no code ?

In the following example, str will be "00:20:34"
C#
TimeSpan test = TimeSpan.FromSeconds(1234);
string str = test.ToString();
 
Share this answer
 
You need to convert second to DateTime object
C#
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
origin.AddSeconds(timestamp);


After that, you can get hour, min, sec, etc... from DateTime object
C#
var hour = origin.Hour;
var min = origin.Minute;
var sec = origin.Second;


for more information; https://msdn.microsoft.com/tr-tr/library/system.datetime(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900