954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

calendar control

hi,

1-how can i do multiselect in calendar.
2-how many days between 2 dates? how can u calculate it?
example :
10/10/2006 - 12/10/2006 there is 1 day between those 2 dates.

thanks

Fenerbahce
Junior Poster in Training
62 posts since Apr 2006
Reputation Points: 15
Solved Threads: 0
 

Actually there are 61 days between those two dates.

Dim date1 As Date = #10/10/2006#
        Dim date2 As Date = #12/10/2006#
        Dim ts As TimeSpan = date2.Subtract(date1)
        Label1.Text = ts.TotalDays.ToString


This is mm/dd/yy. If dd/mm/yy then date difference is 2 days.

Don't know about the calender control.

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 

hi,
thank you very much for your help

Fenerbahce
Junior Poster in Training
62 posts since Apr 2006
Reputation Points: 15
Solved Threads: 0
 

Actually there are 61 days between those two dates.

Dim date1 As Date = #10/10/2006#
        Dim date2 As Date = #12/10/2006#
        Dim ts As TimeSpan = date2.Subtract(date1)
        Label1.Text = ts.TotalDays.ToString

This is mm/dd/yy. If dd/mm/yy then date difference is 2 days. Don't know about the calender control.



Depends on what was meant by "how many days between two dates"
in dd/mm/yy format, there is technically "1" day between those two dates. Monday Oct 16 2006 to Wednesday Oct 18 2006, the day of Tuesday Oct 15 2006 would be the "1" day "between" those two dates.
Just all depends on what the original meaning was :)
Not sure of the actual code, but would be something like
date2.subtract(date1)
Label1.Text = ts.TotalDays.ToString (-2)

The (-2) part (yes i know, not correct probably) would take away 2 from the resulting answer to account for the beginning date and ending date. Again, this is only if you wanted to find out the actual number of days BETWEEN two dates (not counting those days)

ChadW
Light Poster
42 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Yea, same agrument I get from the wife. Next weekend is not the coming weekend but the one following. To me the next weekend is the one that is coming up.

waynespangler
Posting Pro in Training
461 posts since Dec 2002
Reputation Points: 84
Solved Threads: 58
 
Yea, same agrument I get from the wife. Next weekend is not the coming weekend but the one following. To me the next weekend is the one that is coming up.



My daughter is the same way. WOMEN! :mrgreen:

ChadW
Light Poster
42 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You