RESOLVED - Date and time problem

Puppybreath

New member
Joined
Jun 13, 2005
Messages
4
Programming Experience
Beginner
I am trying to add a date and time to a form using a timer control. The code I used for the tick event is:

Private Sub tmrTrial_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTrial.Tick
lblDateandTime.Text = CStr(Now)
End Sub
End Class

This does show the date and time in the form but the format is really strange. The date and time shows as:

6/13/2005 Tuc32on 1:52:32 PM

The number between "Tuc" and "on" matches the value for the seconds and updates as the seconds update. Does anyone have any idea where this is coming from?

Thanks,
Puppybreath
 
Last edited:
try using:

VB.NET:
Private Sub tmrTrial_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTrial.Tick
  lblDateandTime.Text = Now.ToString
End Sub

this puts it in string format using "#/##/#### #:##:## PM"
like "6/13/2005 4:18:24 PM"
 
Back
Top