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
How to Generate XML with C Data and other Nodes.
How to search in Global Address list in outlook using C#, am using the following code
How can i do auto update a gridview in C# windows applications.
how to store a excel sheet into database,and how to retrieve?
Generating a zipOutputstream from a folder having other .zip files in it
Help me to rectify the error(could not open macro storage)
Data Bind for Tree View for Windows Application
Problem -- Display Error Log File in Win 7/8
How to delete a particular mesage in
in XML file using C#
Unable to Read Integers From XL Sheet 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