Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
how do i get the number of days between two dates
February 13, 2009
How do i get the no of days between two given dates. In other ways how can i get the difference between two given dates,
First Date - 1/1/2009
Last Date - 23/1/2009
result would be 22 days.
How can i achieve using C#.
Posted Date: February 14, 2009 Points: 5
Hi Ramesh... just check this...
string diff = ((TimeSpan)(dt2 - dt1)).Days.ToString();
TextBox3.Text = diff.ToString();
I think it may help u..
Posted Date: February 24, 2009 Points: 5
Just try like this..
DateTime LoginTime = DateTime.Parse(1/1/2009);
DateTime LogoutTime = DateTime.Parse( 23/1/2009);
LoginTime = Convert.ToDateTime(LTimes.ToString());
LogoutTime = Convert.ToDateTime(LTimes.ToString());
ts = LogoutTime - LoginTime;
ts = new TimeSpan(LogoutTime.Ticks - LoginTime.Ticks);
TotalTime = ts.Days.ToString();
To post reply
Related Questions Related Questions
How to count number of Days present?
How to find number of days present in a month?
add the specified number of days to current date in c#
What is SQL to get the row number with Where clause
How to find next upcoming birthdays after 15 days using sqlserver?
Random Number code
Serial Number incrementation
Need a Function to be called from a custom validator to check the number of characters in a textbox
Difference between two dates
Regular expression validator for phone number
Latest Forum Questions From The Same Category
USSD using AT COMMAND
The orders after 12 am to 7 am not show timer problem
Debugging File menues like "Save as" in infopath 2010 when we are previewing the form templates
First picture repeating in next rows in crystal reports problem what wrong code
Codec priority settings for C# softphone
Uploading Files using XHR2 to ASP.net Web Service
C# camera SDK for motion detection
Develop Lan Based Video Calling,Voice Calling and Instant Messaging,,
checksum code in 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