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
Develop Lan Based Video Calling,Voice Calling and Instant Messaging,,
checksum code in c#
How to build a remote desktop SIP PBX in C#.NET?
Please help me how to export the database table data to excel sheet
Appropriate Icon in taskbar is not displayed in win 7
How can I convert var(resultset) in to Datatable(when some columns are selecting in linq Query)
Recieve data from serial port continuosly by timer
Please Check the following code
Check the number is Prime or not
How to store listbox selected items into sqlserver
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