datetime class : Equal(datetime) method

Description

Gets a value that indicates whether the argument and the invoker are the same date and time.

Syntax

datetimeInstance.Equal(datetime argDatetime)

Arguments

ClassNameDescription
datetimeargDatetimeA datetime type instance that is compared.

Return value

ClassDescription
boolA value that indicates whether the argument and the invoker are the same date and time.

Sample code

1:

datetime dt = new datetime(2013,12,14,10,10,9);

2:

datetime dt2 = new datetime(2013,12,14,10,10,9);

3:

datetime dt3 = new datetime(2013,12,14,10,10,10);

4:

bool eq1 = dt.Equal(dt); // true

5:

bool eq2 = dt.Equal(dt2); // true

6:

bool eq3 = dt.Equal(dt3); // false

Notes

If the argument and the invoker are the same date and time, return true. Otherwise, return false.

Links for reference

None.

Copyright © Cooker All rights reserved.