i have here a code that add timeintextbox and timeouttextbox to calculate for the total hours work. my problem is that i want to subtract 1hour in the total hours work for the break time..please any idea on how should i do this?
Dim TimeA As Date
Dim TimeB As Date
Dim hh As Integer
Dim mm As Integer
Dim ss As Integer
If Not Date.TryParse(TimeInTextBox.Text, TimeA) Then
' Not a date
End If
If Not Date.TryParse(TimeOutTextBox.Text, TimeB) Then
' Not a date
End If
' Subtract (= time <strong class="highlight">between</strong>)
hh = TimeB.Subtract(TimeA).Hours
mm = TimeB.Subtract(TimeA).Minutes
ss = TimeB.Subtract(TimeA).Seconds
TotalHWTextBox.Text = hh.ToString.PadLeft(2, CChar("0")) & ":" & mm.ToString.PadLeft(2, CChar("0"))
Dim d1 As DateTime
Dim d2 As DateTime
Dim ts As TimeSpan
Dim ts2 As TimeSpan
'Time format is 10:35:23. So in textbox you must type like this...
d1 = DateTime.Parse(Me.TimeInTextBox.Text.Trim)
d2 = DateTime.Parse(Me.TimeOutTextBox.Text.Trim)
ts = d2 - d1
TotalHWTextBox.Text = (ts.ToString)