Click here to Skip to main content
13,147,044 members (62,983 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
how to cpmpare two dates date current date and maximum date ........plzz help me
Posted 4-Nov-12 21:00pm
Comments
Mandy Nagra 5-Nov-12 3:12am
   
plzz anyboday help me
Rate this: bad
 
good
Please Sign up or sign in to vote.

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, ...).
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

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
  Permalink  
Comments
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: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100