16,554
社区成员
发帖
与我相关
我的任务
分享
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim value As String = showtime("113")
Console.WriteLine(value)
End Sub
Private Function showtime(ByVal part As String) As String
Dim mtime As String = part.Trim
Dim len As Integer = mtime.Length
If len = 0 Then Return "00:00:00"
If Not IsNumeric(mtime) Then Throw New Exception
If len = 1 Then
mtime = part.PadRight(5, "0"c)
Else
If mtime.Substring(0, 2) > "12" Then
mtime = part.PadRight(5, "0"c)
Else
mtime = part.PadRight(6, "0"c)
End If
End If
Return Format(Integer.Parse(mtime), "00:00:00")
End Function