How to convert HH: MM: SS to Second?

How can I convert the HH: MM: SS format to the second one?

For example, I want to convert 01:20:30

to 1 Hr = 3600 Sec + 1200 Sec + 30 Sec = 4830 Sec

.

Then I can go to a specific second on WMP. I want to take the mp3 path from MsSQL as you can see. When the form is closed, I want to update the current time from the database.

Example:

I am listening to music at this moment and I am 03:52

into the track. Then I close the form and reopen the music. I want to continue the track, at the same time I closed the form ( 03:52

). How can I do this using Ms SQL?

My current code:

        con.Open();
        SqlCommand cmd = new SqlCommand("select dosyayol from ses", con);
        SqlDataReader oku = cmd.ExecuteReader();
        while (oku.Read())
        {

          pth = oku["dosyayol"].ToString();
        }
        con.Close();
        Player.URL = pth;

      

+3


source to share


1 answer


var ts = TimeSpan.Parse(pth);
ts.TotalSeconds();

      



+4


source







All Articles