Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
How to calclute total time for a week
September 29, 2010
I have totalTime for eachDay in string variable.I am usin forloop to loop through 7 days totaltime.While entering into loop i want to calculate Presnt TotalTime with previous day TotalTime.similarly for 7 days.I want total time for 1 week.
TotalTime like this 9:00
If i store it in string i cannot add String values.What is the better option.Date i have seperate column.Time should be seperate.
Posted Date: September 29, 2010 Points: 5
We have to use the TimeSpan class for this.
DateTime first = DateTime.Today;
DateTime second = DateTime.Today.AddDays(-1);
TimeSpan span = first - second;
span = span.Add(span);
double days = span.TotalDays;
Posted Date: October 04, 2010 Points: 5
just convert the store string to TimeSpan.
then u can compare and get the difference...
Dim d As TimeSpan = CDate(string1).TimeOfDay
Dim d1 As TimeSpan = CDate(string2).TimeOfDay
Dim Minutes As Integer = (string1 - string1).TotalMinutes
now u will get the diff in Minutes...
hope above code will help u.....
To post reply
Related Questions Related Questions
how to display photo of members in gridview at run time?
one project are work in two member we are divide equal form we are join this form to one to copy to form dost not copy to form many time try to way but cannot copy how its copy or join for two form ?
Doubt in Date/time
Calculate running time
display total records in textbox?
diaplaing total contact names in one textbox
displaying total contact names in one textbox in Application
ASP.NET web application - WebResource.axd and ScriptResource.axd files - Loading time issue
ASP.NET - Loading controls at one time (on application load)
Latest Forum Questions From The Same Category
How do i get payment status in redirect page using bitpay?
Login with Facebook and Save details in database
Login with facebook account in my website
How to make a nested datalist control?
What class does Icon derive from?
What are the validation controls?
What''s the difference between an interface and abstract class?
How to read Unicode form PDF File and Save into DataBase ?
How to identify the color format of eps/tiff using c#?
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend