473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to caluclate the days between the two selected dates

hello friends,

Iam developing an leave management application. i want to find number of days a member applied the leaves. iam getting error in finding the days between the two selected dates in ajax calender tool kit.

my error is
Compiler Error Message: CS0029: Cannot implicitly convert type 'System.TimeSpan' to 'System.DateTime'

my code is


Expand|Select|Wrap|Line Numbers
  1. tbStartdate_CalendarExtender.StartDate = DateTime.Today;
  2.  
  3. tbEndDate_CalendarExtender.StartDate = DateTime.Today.AddDays(1);
  4.  
  5.  
  6.  
  7. DateTime StartDate1 = DateTime.ParseExact(tbStartdate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
  8.  
  9. DateTime EndDate1 = DateTime.ParseExact(tbEnddate.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
  10.  
  11.  
  12.  
  13. DateTime leavesRemaining1 = EndDate1.Subtract(StartDate1);
Sep 7 '12 #1
1 1950
Rabbit
12,516 Expert Mod 8TB
It would help to know what line the error is on, but it's probably line 13. The subtract method returns a TimeSpan, not a DateTime.
Sep 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JAPIO | last post by:
I have two variables which look like: $begin = "23-08-05" $end = "26-08-05" Now i want also to know the dates between them. 24-08-05 25-08-05 How can i do this? Any help would be...
0
by: King Adrock | last post by:
Just thought I'd save anyone some time if they had this problem, before I wrote code like this myCalendar.SelectedDate = myObject.CreatedDate; After upgrade to full RTM I noticed my calendars...
4
by: Good Man | last post by:
Hi there I have a list of jobs scheduled in a MySQL table, with start dates and end dates, like so: SchedID | JobID | StartDate | EndDate |...
2
by: tasmontique | last post by:
I am working on an access 2002 flight schedule database. I am new to access but have some basic understanding of sql and vb6 code. I have learned a lot from this website. Thanks much Hopefully...
0
by: ramesh.nrk | last post by:
Hi, In my windows application I need to display MonthCalendar control with some selected dates. I am using the property "Bolded Dates" to add selected/some dates. But those dates are displayed in...
1
by: AllyFrog | last post by:
Hello, I have a database which manages bookings for casual staff. When bookings are for just one day, then they can be entered as a new record into a form. Frequently however, a booking may be...
3
by: Jim | last post by:
Guys I'm rusty. Haven't messed with Access in a while. I'm trying to determine how many workdays (or weekdays) between two dates. I don't think their are any "canned" functions within access -...
3
by: John | last post by:
Hi How can I calculate days from the two dates entered in date time picker fields on winform by a user? Thanks Regards
9
by: sha2484 | last post by:
I need help to count days between 2 dates,where i want to count the days between current date and registeration date.Here is the code that i have write but it only compare the days , it do not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.