Lets say I have two date time picker controls, 1 and 2
a textbox and a button.
The datetimepickers are in a custom format-hh:mm tt- to display time only.
The below code can get the timespan between a start time and and end time.
My problem is where the start time is say 11.00PM and the stop time is 01.15AM.
I realise that this is the next day whilst the date time picker date hasn't changed at all.
How do i solve the problem?
The other problem is that the datetimepickers cannot display midnight valuess ie 00.15 for example.
How can i show midnight times in a date time picker?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim starttime As DateTime = DateTimePicker1.Value
Dim endtime As DateTime = DateTimePicker2.Value
Dim results As TimeSpan = starttime - endtime
TextBox1.Text = results.Duration.ToString