speakers_86
Registered User.
- Local time
- Today, 02:03
- Joined
- May 17, 2007
- Messages
- 1,919
Use it if you need. Credit is appreciated.
Code:
Public Function MilitaryTime(Optional dtedate As Variant) As String
If IsMissing(dtedate) Then dtedate = Now
If IsNull(dtedate) Then dtedate = Now
Dim a As String
a = DatePart("m", dtedate)
Dim b As String
b = DatePart("d", dtedate)
Dim c As String
c = DatePart("yyyy", dtedate)
Dim d As String
d = DatePart("h", dtedate)
Dim e As String
e = DatePart("n", dtedate)
MilitaryTime = a & "/" & b & "/" & c & " " & d & e
End Function
Public Function Convert2Date(Optional dtedate As Variant) As Date
Dim dte As String
dte = MilitaryTime(dtedate)
Dim strLeft As String
strLeft = Mid(dte, 1, 13)
Dim strRight As String
strRight = Mid(dte, 14, 2)
MsgBox strLeft & strRight
Convert2Date = CDate(strLeft & ":" & strRight)
End Function