Tuesday, November 18, 2008

Convert seconds in time format HH:mm:ss in asp.net C#

Convert second in to time format HH:mm:ss in asp.net c# :

Introduction : In this article i will show you how to convert seconds in time format HH:mm:ss in asp.net c# .
It is very easy .I have used TimeSpan to get time format HH:mm:ss from seconds .

Code for Convert to seconds in time format HH:mm:ss in c# :

protected void Page_Load(object sender, EventArgs e)
{
    Response.Write(GetTimeFormat(1000)); // pass seconds here in integer
}
public string GetTimeFormat(int Seconds)
{
    string timeformat = string.Empty;
    TimeSpan Mytimes = new TimeSpan(0, 0, Seconds);
    timeformat = new DateTime(Mytimes.Ticks).ToString("HH:mm:ss");
    return timeformat;
}

Related Other posts

1 comments:

  1. awesome post! Keep up the sweet work!
    my webpage - McAllen Homes for Sale

    ReplyDelete