C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Datetime Manipulation in Vb.net - Part 2


Posted Date: 18 Aug 2008    Resource Type: Articles    Category: .NET Framework
Author: D.Jeya kumar(JK)Member Level: Diamond    
Rating: 1 out of 5Points: 10



List for DateTime function

DateTime.Compare

Compare function is to compare between 2 dates and it will return integer values based on the comarisons 0 means both are equal, 1 means first date is greater then second. -1 means first date is less then the second one.

Syntax:
DateTime.Compare(Date1, Date2)
Example

DateTime.Compare(DateTime.Now.AddHours(1), DateTime.Now)


will return the integer

< 0 t1 is lesser then t2
= 0 t1 is equal to t2
> 0 t1 is greater then t2

DaysInMonth
It will return the days for the month for the specified month and year.

Syntax
DateTime.DaysInMonth(year, month)

Example



MsgBox(DateTime.DaysInMonth(2008, 10)) will
MonthName(1) will return January for the sepcified year and month in integer.


Equals
To compare between 2 date and check whether the two dates are equal r not we can use Equals function from date time
Syntax
Equals(Date1,Date2) returns Boolean


Example
Dim dt1 As DateTime
Dim dt2 As DateTime

dt1 = Now.Date
dt2 = Now.Date.AddHours(10)

If DateTime.Equals(dt1, dt2) Then
MsgBox(dt1 & " and " & dt2 & " are equal ")
Else
MsgBox(dt1 & " and " & dt2 & " not are equal ")
End If

[CODE/]
End of part-2
....continued




Responses


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

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Datime Manupulation for VB.net  .  Datetime Format in .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: Datetime Manipulation in Vb.net - Part 1
Previous Resource: Datetime Manipulation in Vb.net - Part 3
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use