![]() |
Code for calculating Time difference
1 Attachment(s)
I am making a chart for calculating time difference in VB (Form with textboxes is attached for your perusal) how i write code for calculating time difference.
|
Re: Code for calculating Time difference
convert hours to minutes and add the minutes for both start and end
then subtract and convert back to hours. for example start 10:34 end 12:12 start-->10*60+34=694minutes end-->12*60+12=732minutes timediff=end-start=732-694=38---->0 hours 38 minutes. things to consider ================ 1) time must be in 24hr format 2) end time must be after start time -->error message or you assume it belongs to the next day. (start=23:50 end=00:10) (in this case you must add 24 hours to hours) |
Re: Code for calculating Time difference
Srry. I am new bee in coding but then also I have writing code like this:
Private Sub Text14_Click() Text2.Text = "h" Text3.Text = "n" Text4.Text = "h" Text5.Text = "n" Text2.Text = 10 * 60 + 34 = 694 Text4.Text = 12 * 60 + 12 = 732 Text14.Text = timediff = Text4.Text - Text2.Text End Sub |
Re: Code for calculating Time difference
please correct it if their is any mistake
|
Re: Code for calculating Time difference
1 Attachment(s)
from the code you posted i assume you are talking about
visual basic 6. i made you a simple project to see how it's done. for questions post here. |
Re: Code for calculating Time difference
Thanks for your help.
|
| All times are GMT +5.5. The time now is 19:58. |