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
|
No responses found. Be the first to respond and make money from revenue sharing program.
|