Hi
I'm trying to convert Time (hh:mm) into a text string (hhmm). I'm using 24 hour not AM/PM.
It is working fine except when it's before 10 o'clock. When it's 09:15 the text string is 915 instead of 0915.
How do I keep the leading 0?
OpgaveStart is a Date/Time field (hh:mm)
My code is simple:
Dim TST1 As String
TST1 = OpgaveStart
TST1 = Format(OpgaveStart, "hhmm")
If TST1 > 100 Then
STUFORMAT = "0" & TST1
Else
STUFORMAT = TST1
End If
Any ideas?
I'm trying to convert Time (hh:mm) into a text string (hhmm). I'm using 24 hour not AM/PM.
It is working fine except when it's before 10 o'clock. When it's 09:15 the text string is 915 instead of 0915.
How do I keep the leading 0?
OpgaveStart is a Date/Time field (hh:mm)
My code is simple:
Dim TST1 As String
TST1 = OpgaveStart
TST1 = Format(OpgaveStart, "hhmm")
If TST1 > 100 Then
STUFORMAT = "0" & TST1
Else
STUFORMAT = TST1
End If
Any ideas?