Edit

Share via


EntityFunctions.DiffYears Method

Definition

Invokes the canonical DiffYears function. For information about the canonical DiffYears function, see Date and Time Canonical Functions.

Overloads

DiffYears(Nullable<DateTime>, Nullable<DateTime>)

Invokes the canonical DiffYears function. For information about the canonical DiffYears function, see Date and Time Canonical Functions.

DiffYears(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Invokes the canonical DiffYears function. For information about the canonical DiffYears function, see Date and Time Canonical Functions.

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database.

DiffYears(Nullable<DateTime>, Nullable<DateTime>)

Invokes the canonical DiffYears function. For information about the canonical DiffYears function, see Date and Time Canonical Functions.

public:
 static Nullable<int> DiffYears(Nullable<DateTime> dateValue1, Nullable<DateTime> dateValue2);
[System.Data.Objects.DataClasses.EdmFunction("Edm", "DiffYears")]
public static int? DiffYears (DateTime? dateValue1, DateTime? dateValue2);
[<System.Data.Objects.DataClasses.EdmFunction("Edm", "DiffYears")>]
static member DiffYears : Nullable<DateTime> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DiffYears (dateValue1 As Nullable(Of DateTime), dateValue2 As Nullable(Of DateTime)) As Nullable(Of Integer)

Parameters

dateValue1
Nullable<DateTime>

A valid date.

dateValue2
Nullable<DateTime>

A valid date.

Returns

The number of years between dateValue1 and dateValue2.

Attributes

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database.

Applies to

DiffYears(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Invokes the canonical DiffYears function. For information about the canonical DiffYears function, see Date and Time Canonical Functions.

public:
 static Nullable<int> DiffYears(Nullable<DateTimeOffset> dateValue1, Nullable<DateTimeOffset> dateValue2);
[System.Data.Objects.DataClasses.EdmFunction("Edm", "DiffYears")]
public static int? DiffYears (DateTimeOffset? dateValue1, DateTimeOffset? dateValue2);
[<System.Data.Objects.DataClasses.EdmFunction("Edm", "DiffYears")>]
static member DiffYears : Nullable<DateTimeOffset> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DiffYears (dateValue1 As Nullable(Of DateTimeOffset), dateValue2 As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

Parameters

dateValue1
Nullable<DateTimeOffset>

A valid date time offset.

dateValue2
Nullable<DateTimeOffset>

A valid date time offset.

Returns

The number of years between dateValue1 and dateValue2.

Attributes

Remarks

You cannot call this function directly. This function can only appear within a LINQ to Entities query.

This function is translated to a corresponding function in the database.

Applies to