Monday, April 28, 2008

How to get day different between two date and check consecutive date (C#)?


Recently, I am writing a code that need to check whether the user selected date is consecutive or not. Since user is using a multiple selectable calendar that consists of three different months so he/she is allow to choose whichever date they want. In order to allow me to check the consecutive date, first I need to find the maximum and minimum date value in my propertiesCollection. However, there are no indicator for propertiesCollection as what Array have, so I first loop all the value in propertiesCollection into an Array. After that, I sort the Array and write some code to get the maximum and minimum value.

After getting the max and min, I use TimeSpan object in C# and get the day different of these two date.

Due to the limitation of the editor. For full code please kindly visit link below:

http://www.ahwooi.com/2008/04/29/how-to-get-day-different-between-two-date/

No comments: