Pages

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

21 comments:

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

    ReplyDelete
  2. Exactly to the point.

    ReplyDelete
  3. Great !! Thank's a lot

    ReplyDelete
  4. قطعات کیا
    <a href="https://www.star.parts/shop/>فروشگاه اینترنتی لوازم یدکی خودرو</a>

    ReplyDelete
  5. amazing write , keep posting and if you are intresting in big data coder and code developer then checkout java classes in satara

    ReplyDelete