Win Surprise Gifts!!!
Top 5 Contributors of the Month
Vijai Anand. R
Kemal AL GAZZAH
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
In DataGrid I have Two Dropdownlist, One in Header template and Item Template
Display data directly from database table to PDF using stored procedures in asp.net C#
How to install and use Dev Express ?
Dialogbox Custom Control
Custom Control in Winforms
I just started learning c#.net console application
How to read csv file which have many special character and tabs?
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
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