Hi guys,

I'm having a little problem trying to figure out how to get only the time from a datetimepicker.

I've set up a datetimepicker to only allow user selection of time by setting Format to Time and ShowUpDown to True.

However, when I store the value of the datetimepicker to a variable, it returns a date as well.

vb.net Code:
  1. JustTime = DateTimePicker1.Value

I tried to get around the issue by using:

vb.net Code:
  1. JustTime = DateTimePicker1.Value.hour & ":" & DateTimePicker1.Value.minute & ":" & DateTimePicker1.Value.second

However, this seems like a really inelegant solution and I can't figure out how to get an AM/PM behind that.

I feel like I'm missing some really simple solution that I'm just not seeing! There HAS to be a way to get just the time!

If anyone could help me out, it would be most appreciated!