C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Comparing DateTime objects


Posted Date: 20 Feb 2008    Resource Type: Code Snippets    Category: Date & Time

Posted By: anish varghese       Member Level: Silver
Rating:     Points: 5



The sample code compares two dates "date1" and "date2".

The static DateTime.Compare() function is used to compare two DateTime objects. This function returns an integer. If it returns 0, it means that the two dates are the same. A negative integer implies that the date DateTime differs, with first parameter earlier than the other(by the returned amount). A positive result implies the contrary.



'Comparing Date
'How to Find whether both dates are equal or Not?
'How to compare two dates in .Net?
If DateTime.Compare(date1,date2) = 0 Then
Response.Write("Are both Dates Equal" + "
")
Else If DateTime.Compare(date1,date2) < 0 Then
Response.Write(date1.ToString() + " is Less than " + dt5.ToString() + "
")
Else
Response.Write(date1.ToString() + " is Greater than " + date2.ToString() + "
")
End If





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Vb.net  .  Datetime compare  .  DateTime  .  Date comparison  .  Date Compare  .  Date and time comparison  .  Date  .  Compare dates  .  Compare Date  .  Asp.net  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Culture Info in ASP.Net
Previous Resource: Week of the Year
Return to Discussion Resource Index
Post New Resource
Category: Date & Time


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use