getting difference of time and how to add results
pls help.. I have a to create a timecard calculator. it goes this way
txtbox1 is for their 1st in
txtbox2 is for their 1st out
textbox3 is for the difference of txtbox1 and textbox2
txtbox4 is for their 2st in
txtbox5 is for their 2st out
textbox6 is for the difference of txtbox4 and textbox5
textbox7 is for the sum of total hour and minutes of textbox3 and textbox6
kishpopboy
Newbie Poster
15 posts since Feb 2012
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0
declare two date type variables ..
Now make 1st with textbox1's value.
and 2nd with textbox2's value.
now declare a timespan variable and simply.
do..
ts=d1-d2
here ts is the timespan. in timespan you can get the total minutes....
kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0
thank you sir....I'll try this one
kishpopboy
Newbie Poster
15 posts since Feb 2012
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0
what i did is this
dim val1 as date
dim val2 as date
dim val1 as timespan
val1= textbox1.text
val2= textbox2.text
val3= val2-val1
textbox3.text= val3
but its doesn't work.. im sory Im a bit slow about
pls show me codes..
thanks
kishpopboy
Newbie Poster
15 posts since Feb 2012
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0
Dim d1 As DateTime
Dim d2 As DateTime
Dim ts As TimeSpan
'Time format is 10:35:23. So in textbox you must type like this...
d1 = DateTime.Parse("1/1/2012 " + Me.TextBox1.Text.Trim)
d2 = DateTime.Parse("1/1/2012 " + Me.TextBox2.Text.Trim)
ts = d2 - d1
MsgBox(ts.ToString)
Don't forget to give reputation....
kingsonprisonic
Posting Whiz in Training
268 posts since Nov 2009
Reputation Points: 61
Solved Threads: 54
Skill Endorsements: 0
kishpopboy
Newbie Poster
15 posts since Feb 2012
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by
kingsonprisonic