473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datetime arithmetic in VB.Net?

I have a program that processes a large number of records & would like to
display the remaining time, in days:hours:minutes.

I'm looking to do something like:

Dim tsTimeRemaining as System.Timespan
Dim tsElapsedTime as System.Timespan
dtTimeRemaining = intRemainingRecords * (tsElapsedTime /
intRecordsAlreadyProcessed)

Could someone help me out with the appropriate arithmetic
operators/casts/etc.

Thanks.

Joe

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Mar 15 '06 #1
2 2991
"Joe Befumo" <jo*@befumo.com> schrieb
I have a program that processes a large number of records & would
like to display the remaining time, in days:hours:minutes.

I'm looking to do something like:

Dim tsTimeRemaining as System.Timespan
Dim tsElapsedTime as System.Timespan
dtTimeRemaining = intRemainingRecords * (tsElapsedTime /
intRecordsAlreadyProcessed)

Could someone help me out with the appropriate arithmetic
operators/casts/etc.


Function GetTotalTime( _
ByVal Counter As Integer, _
ByVal Total As Integer, _
ByVal Elapsed As TimeSpan, _
ByRef Remaining As TimeSpan) _
As TimeSpan

GetTotalTime = TimeSpan.FromSeconds(Elapsed.TotalSeconds / Counter *
Total)
Remaining = GetTotalTime.Subtract(Elapsed)

End Function

Returns the total time as the function value and the remaining time as a
parameter.
Armin

Mar 15 '06 #2
Great, thanks so much!

Joe

"Armin Zingler" <az*******@freenet.de> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...
"Joe Befumo" <jo*@befumo.com> schrieb
I have a program that processes a large number of records & would
like to display the remaining time, in days:hours:minutes.

I'm looking to do something like:

Dim tsTimeRemaining as System.Timespan
Dim tsElapsedTime as System.Timespan
dtTimeRemaining = intRemainingRecords * (tsElapsedTime /
intRecordsAlreadyProcessed)

Could someone help me out with the appropriate arithmetic
operators/casts/etc.


Function GetTotalTime( _
ByVal Counter As Integer, _
ByVal Total As Integer, _
ByVal Elapsed As TimeSpan, _
ByRef Remaining As TimeSpan) _
As TimeSpan

GetTotalTime = TimeSpan.FromSeconds(Elapsed.TotalSeconds / Counter *
Total)
Remaining = GetTotalTime.Subtract(Elapsed)

End Function

Returns the total time as the function value and the remaining time as a
parameter.
Armin


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Mar 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Terry Hancock | last post by:
What do you do when a date or time is incompletely specified? ISTM, that as it is, there is no formal way to store this --- you have to guess, and there's no way to indicate that the guess is...
6
by: Thomas Bartkus | last post by:
MySQL Version 4.0.20 on a Linux server. How does one get the elapsed time between (2) DateTime values? I need the answer to the nearest minute. Is upgrading to Ver 5 with its more robust...
3
by: arijitchatterjee123 | last post by:
Hi Group, I am new with SQL Server..I am working with SQL Server 2000. I am storing the date in a nvarchar column of atable.... Now I want to show the data of Weekends..Everything is OK...But the...
4
by: Saso Zagoranski | last post by:
Hi! I have created an SqlCommand object and I have set some parameters to it... One of the parameters is of the DateTime type; here is the code: sqlCommand.Parameters.Value =...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
2
by: Mark | last post by:
Hi.. I'm writing a web service in C# and needs to produce some time_t values in the xml output, and near as I can figure there appears to be a bug in the C# datetime arithmetic. Below is an...
5
by: Simen Haugen | last post by:
Hi. How can I convert a python datetime to a timestamp? It's easy to convert a timestamp to datetime (datetime.datetime.fromtimestamp(), but the other way around...?) -Simen
2
by: Mintyman | last post by:
Hi, I have the following query: SELECT dbo._Fault.id, dbo._Fault.date_created, dbo._Fault.reference, dbo._Fault.class, dbo._Fault.owner, dbo._Fault.Contact_Name, dbo._Fault. Product,...
0
by: Massimiliano Campagnoli | last post by:
Hy All, is there a library in C++ supporting datetime arithmetic over a given business calendar. For instance, a typical 8 hours shift in a company is from 8am to 12am and from 1:30pm to 5:30pm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.