Lots of troubles with DateTime fields today…
I have a DateTime field that I want to separate and display as a date in one DateTimePicker and a time in another DTP. This is what I tried:
dtp_date.Value = myRow.myDateTime.Date;
dtp_time.Value = myRow.myDateTime.TimeOfDay;
I’m getting an error that says it can’t convert type ‘System.TimeSpan’ to ‘System.DateTime’. I guess I just don’t understand what I need to do differently. All it will do is display the time of day right now, not the one stored in my DateTime field.
Anyone know how to extract the time?
Try giving the DateTimePicker a valid date AND time. Hide the date on display and only show the time using DateTimePickerFormat.Time
Pop in your time values from the myRow.myDateTime field