Microsoft
Software
Hardware
Network
Question : Calculate difference in time, and get the integer value
Hi there.
I'm making a small program that is based on calculating the difference between groups of two times. The times comes from two textboxes as a string (length 4).
Then I converts the text strings to dateformat, and take out the time (hour and minute) from these two.
I then want to have the difference between those two times generated in Integer type.
So: Let's say we have txtTime1="1200" and txtTime2="1845"
This gives a time difference of 6 hours and 45 minutes.
I want the result (0.28125) to be put into a Integer variable i.e. Time3.
I need this Time3 do do some more calculations in my program.
Please advise - I use VB2008 Express Edition.
Answer : Calculate difference in time, and get the integer value
the tSpan.TotalDays returns a double value. You dont want int because it rounds the value to nearest whole number so
int(1.28) = 1
int(0.28) = 0
Do this
Dim tDays as Double = tSpan.TotalDays
Random Solutions
QueryTable.Connection error
How to popup a waraning dialog box in asp.net?
Backup of ESXi when no other Windows Server
Automatic delete of files in delete folder, on exit, in Outlook no longer works?
Microsoft Vista SystemPropertiesComputerNa<wbr />me at Logon?
How do I add users to SharePoint 2.0 site via Address Book in Office 2007?
Exchange 2007 mail redirect to external address?
Authentication for OWA in Exchange 2007 fails.
There is a(n) " in the form control's validationrule property
Install Office Small Business 2007 using .msi file