Minutes to Hours Conversions in VB.NET
-
I'm trying to write a program that will convert minutes to hours. For example, say a user inputs that they had 1,256 minutes logged on somewhere and they wanted to know how much that would be in hours (20.93 hours, but I need it to be displayed as 21 Hours and 55 Minutes.) Is there any built in method or function that .NET can use to calculate values on hourly or minutely fashion? I've tried the dynamic help, but the time functions in there display dates and such. I fear I may have to do it the old fashioned way with many mathimatical hijinx! :(( The Jazz Master 6000 DJ Badknees Parma Grind Crew - www.geocities.com/parmagrindcrew
-
I'm trying to write a program that will convert minutes to hours. For example, say a user inputs that they had 1,256 minutes logged on somewhere and they wanted to know how much that would be in hours (20.93 hours, but I need it to be displayed as 21 Hours and 55 Minutes.) Is there any built in method or function that .NET can use to calculate values on hourly or minutely fashion? I've tried the dynamic help, but the time functions in there display dates and such. I fear I may have to do it the old fashioned way with many mathimatical hijinx! :(( The Jazz Master 6000 DJ Badknees Parma Grind Crew - www.geocities.com/parmagrindcrew
this may help : VbCode:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim x As DateTime = New DateTime()
Dim mins As Double = 120 '/// minutes
MessageBox.Show(x.AddMinutes(mins)) '/// return the value ( eg: 02:00:00 being 120 minutes )
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
:) Vb:
Public Function TwinsOnWay(ByVal twins As String) As String
Select Case twins
Case "Gender"
Return "Two Girls"
End Select
End Function
-
this may help : VbCode:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim x As DateTime = New DateTime()
Dim mins As Double = 120 '/// minutes
MessageBox.Show(x.AddMinutes(mins)) '/// return the value ( eg: 02:00:00 being 120 minutes )
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
:) Vb:
Public Function TwinsOnWay(ByVal twins As String) As String
Select Case twins
Case "Gender"
Return "Two Girls"
End Select
End Function
Hey! Thanks a lot! This is just what I was looking for! Would I have to use the Format Function in able to just return a single value? Such as "2" being the number of hours? Or would I have to use some tricky string functions? :-DCongradulations on the two girls!!!:-D The Jazz Master 6000 DJ Badknees Parma Grind Crew - www.geocities.com/parmagrindcrew