DateTimePicker and saving time only..

  • Thread starter Thread starter Aaron Smith
  • Start date Start date
A

Aaron Smith

How do you get the datetimepicker to save only the time to a databound
field? I have tried format and parse, and the functions work, getting
the cevent.value = "1:25 PM" but it always saves the current date along
with it.. I also have the custom format property set to "hh:mm tt" and
the format and parse have thier formatting set to the same...

Private Sub FormatTime(ByVal sender As Object, ByVal cevent As
ConvertEventArgs)
If Not cevent.DesiredType Is GetType(DateTime) Then
Exit Sub
End If
cevent.Value = CType(cevent.Value,
System.DateTime).ToString("hh:mm tt")
End Sub

Private Sub ParseTime(ByVal sender As Object, ByVal cevent As
ConvertEventArgs)
If Not cevent.DesiredType Is GetType(DateTime) Then
Exit Sub
End If
cevent.Value = CType(cevent.Value,
System.DateTime).ToString("hh:mm tt")
End Sub

Thanks,
Aaron
 
Back
Top