Click here to Skip to main content
13,048,584 members (80,744 online)
Rate this:
Please Sign up or sign in to vote.
See more:
In my textbox i have assigned datetime of particular day. Here am going to compare particular datetime(Assigned in textbox) to System date time.. Can any one help me??

Thanks in advance :)
Posted 21-Dec-12 21:06pm
Krunal Rohit 22-Dec-12 3:13am
Elaborate your question.. We can't work out from this least information that you have provided.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In c# there is a method called
read the example given below
DateTime date1 = new DateTime(2009, 8, 1, 0, 0, 0);
DateTime date2 = new DateTime(2009, 8, 1, 12, 0, 0);
int result = DateTime.Compare(date1, date2);
string relationship;
if (result < 0)
   relationship = "is earlier than";
else if (result == 0)
   relationship = "is the same time as";         
   relationship = "is later than";
Console.WriteLine("{0} {1} {2}", date1, relationship, date2);
// The example displays the following output:
//    8/1/2009 12:00:00 AM is earlier than 8/1/2009 12:00:00 PM

for more information you can look msdn

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 | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Dec 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