13,147,044 members (62,983 online)
Rate this:
See more:
how to cpmpare two dates date current date and maximum date ........plzz help me
Posted 4-Nov-12 21:00pm
Mandy Nagra 5-Nov-12 3:12am

plzz anyboday help me

Rate this:

## Solution 1

Look at DateTime.Compare Method for straight compare method, or
DateTime.Subtract Method to get a time-span between the two source dates, so that you can analyze every date/time component by itself (year, day, minute, ...).
Rate this:

## Solution 2

DateTime srtdate = Convert.ToDateTime(allitem["StartDate"].Text.ToString());
DateTime srtdate = Convert.ToDateTime(allitem["StartDate"].Text.ToString());

(DateTime.Now.ToShortDateString() >= srtdate.ToShortDateString())

Start Date - 22-Feb-2012 AND End Date - 22-Feb-2012
if ((DateTime.Today >= strdate.Date) && (DateTime.Today <= enddate.Date))
lblCondition.Text = "CHECKED";

this Way u Can compare two dates
Daniele Rota Nodari 12-Nov-12 6:09am

Compare dates converted to string format is culture dependent, and thus is likely to not work in many cultures
Rate this:

## Solution 3

Means what , input should not be greater than current date? or compare two dates value?

Top Experts
Last 24hrsThis month
 OriginalGriff 315 CPallini 55 Graeme_Grant 50 RickZeeland 40 Jochen Arndt 30
 OriginalGriff 6,125 Graeme_Grant 5,101 ppolymorphe 1,984 Jochen Arndt 1,904 CPallini 1,855