DbFunctions.DiffYears Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DiffYears(Nullable<DateTime>, Nullable<DateTime>) |
When used as part of a LINQ to Entities query, this method invokes the canonical DiffYears EDM function to calculate the number of years between two date/times. |
DiffYears(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>) |
When used as part of a LINQ to Entities query, this method invokes the canonical DiffYears EDM function to calculate the number of years between two date/times. |
DiffYears(Nullable<DateTime>, Nullable<DateTime>)
When used as part of a LINQ to Entities query, this method invokes the canonical DiffYears EDM function to calculate the number of years between two date/times.
[System.Data.Entity.DbFunction("Edm", "DiffYears")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="dateValue2")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="dateValue1")]
public static Nullable<int> DiffYears (Nullable<DateTime> dateValue1, Nullable<DateTime> dateValue2);
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
Returns
The number of years between the first and second date/times.
- 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>)
When used as part of a LINQ to Entities query, this method invokes the canonical DiffYears EDM function to calculate the number of years between two date/times.
[System.Data.Entity.DbFunction("Edm", "DiffYears")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="dateValue1")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="dateValue2")]
public static Nullable<int> DiffYears (Nullable<DateTimeOffset> dateValue1, Nullable<DateTimeOffset> dateValue2);
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>
The first date/time.
- dateValue2
- Nullable<DateTimeOffset>
The second date/time.
Returns
The number of years between the first and second date/times.
- 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
Entity Framework