Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,900 questions

51,831 answers

573 users

How to convert hh:mm:ss to minutes in VB.NET

1 Answer

0 votes
Imports System

Class Program
	Public Shared Function HhmmssToMinutes(ByVal hhmmss As String) As Double
        Dim timeParts As String() = hhmmss.Split(":"c)
		
        Dim hours As Integer = Integer.Parse(timeParts(0))
        Dim minutes As Integer = Integer.Parse(timeParts(1))
        Dim seconds As Integer = Integer.Parse(timeParts(2))
        Return (hours * 60) + minutes + (seconds / 60.0)
    End Function

    Public Shared Sub Main()
        Console.WriteLine(HhmmssToMinutes("2:30:00"))
        Console.WriteLine(HhmmssToMinutes("2:35:30"))
        Console.WriteLine(HhmmssToMinutes("5:00:45"))
    End Sub
End Class


' run:
'
' 150
' 155.5
' 300.75
'

 



answered Apr 17, 2025 by avibootz

Related questions

1 answer 46 views
1 answer 121 views
1 answer 147 views
1 answer 152 views
1 answer 66 views
1 answer 82 views
1 answer 73 views
...