Imports System.Environment
Private Sub Show_PCUp_Time()
Dim strDisplay As String
Dim SecondValue As Double
Dim TMP1 As Double
Dim TMP2 As Double
Dim TMP3 As Double
Dim Days As Integer
Dim Hours As Integer
Dim Minutes As Integer
Dim Seconds As Integer
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim str4 As String
Dim strSub As String
SecondValue = Format(TickCount / 1000, "0")
Days = Math.Floor(SecondValue / 86400)
If Days > 0 Then
TMP1 = SecondValue - (Days * 86400)
Else
TMP1 = SecondValue
End If
Hours = Math.Floor(TMP1 / 3600)
If Hours > 0 Then
TMP2 = TMP1 - (Hours * 3600)
Else
TMP2 = TMP1
End If
Minutes = Math.Floor(TMP2 / 60)
If Minutes > 0 Then
TMP3 = TMP2 - (Minutes * 60)
Else
TMP3 = TMP2
End If
Seconds = Math.Floor(TMP3)
If Days > 0 And Days < 1 Then
str1 = CStr(Days) & " Day"
Else
If Days > 1 Then
str1 = CStr(Days) & " Days"
Else
str1 = " "
End If
End If
If Hours > 0 And Hours < 1 Then
str2 = CStr(Hours) & " Hour"
Else
If Hours > 1 Then
str2 = CStr(Hours) & " Hours"
Else
str2 = " "
End If
End If
If Minutes > 0 And Minutes < 1 Then
str3 = CStr(Minutes) & " Minute"
Else
If Minutes > 1 Then
str3 = CStr(Minutes) & " Minutes"
Else
str3 = " "
End If
End If
If Seconds > 0 And Seconds < 1 Then
str4 = CStr(Seconds) & " Second"
Else
If Seconds > 1 Then
str4 = CStr(Seconds) & " Seconds"
Else
str4 = " "
End If
End If
strDisplay = str1 & ", " & str2 & ", " & str3 & ", " & str4 & " "
strDisplay = Trim(Replace(strDisplay, ", ", " "))
strSub = Microsoft.VisualBasic.Left(strDisplay, 1)
If strSub = "," Then
strDisplay = Microsoft.VisualBasic.Right(strDisplay, Len(strDisplay) - 1)
End If
strSub = Microsoft.VisualBasic.Left(strDisplay, 1)
If strSub = "," Then
strDisplay = Microsoft.VisualBasic.Right(strDisplay, Len(strDisplay) - 1)
End If
strSub = Microsoft.VisualBasic.Left(strDisplay, 1)
If strSub = "," Then
strDisplay = Microsoft.VisualBasic.Right(strDisplay, Len(strDisplay) - 1)
End If
strSub = Microsoft.VisualBasic.Left(strDisplay, 1)
If strSub = "," Then
strDisplay = Microsoft.VisualBasic.Right(strDisplay, Len(strDisplay) - 1)
End If
strDisplay = Replace(strDisplay, "s ,", "s,")
strDisplay = Replace(strDisplay, "y ,", "y,")
strDisplay = Replace(strDisplay, "r ,", "r,")
strDisplay = Replace(strDisplay, "e ,", "e,")
strDisplay = Replace(strDisplay, "d ,", "d,")
MsgBox(strDisplay)
End Sub