Date Format in VBA Code

ant1983za

Registered User.
Local time
Today, 06:16
Joined
Jul 2, 2013
Messages
14
Hi,

I am a newbie and need help with setting the date format of the below dateBookingTime field. It currently desplays as 07:30:00 PM but i want it to display as 19:30:

Private Sub Form_Load()

'Chauffer Drive
If numTransferType = 1 Then
txtMessageOutput = "Dear " & Title & " " & txtPassengerName & ", " & "Confirming your collection at " & dateBookingTime & " on " & dateBookingDate & " from " & FullFromAddress & " for " & txtChaufferDuration & " Chauffer Drive. Regards, xxxxxxxxx"

'Point-To-Point
ElseIf numTransferType = 2 Then
txtMessageOutput = "Dear " & Title & " " & txtPassengerName & ", " & "Confirming your collection at " & dateBookingTime & " on " & dateBookingDate & " from " & FullFromAddress & " to " & FullToAddress & ". Regards, xxxxxxxxx"

'Airport Transfer Departure
ElseIf numTransferType = 3 And blnDeparture = True Then
txtMessageOutput = "Dear " & Title & " " & txtPassengerName & ", " & "Confirming your collection at " & dateBookingTime & " on " & dateBookingDate & " from " & FullFromAddress & " to ORT. Regards, xxxxxxxxx"

'Airport Transfer Arrival
ElseIf numTransferType = 3 And blnDeparture = False Then
txtMessageOutput = "Dear " & Title & " " & txtPassengerName & ", " & "Confirming your collection at " & dateBookingTime & " on " & dateBookingDate & " from " & "ORT to " & FullToAddress & ". Regards, xxxxxxxxx"

'Tour
ElseIf numTransferType = 4 Then
txtMessageOutput = "Dear " & Title & " " & txtPassengerName & ", " & "Confirming your collection at " & dateBookingTime & " on " & dateBookingDate & " from " & FullFromAddress & " for TOUR. Regards, xxxxxxxxx"

End If

End Sub


Thanks

Ant
 
you need to use the format function i.e.

format(dateBookingTime,"hh:nn")
 
Thanks that worked :)
 

Users who are viewing this thread

Back
Top Bottom