DbFunctions.DiffHours Method
When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two date/times.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | DiffHours(Nullable<DateTime>, Nullable<DateTime>) | When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two date/times. |
![]() ![]() | DiffHours(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>) | When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two date/times. |
![]() ![]() | DiffHours(Nullable<TimeSpan>, Nullable<TimeSpan>) | When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two time spans. |
DbFunctions.DiffHours Method (Nullable<DateTime>, Nullable<DateTime>)
When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two date/times.
[DbFunctionAttribute("Edm", "DiffHours")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue1")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue2")] public static Nullable<int> DiffHours( Nullable<DateTime> timeValue1, Nullable<DateTime> timeValue2 )
Parameters
- timeValue1
-
Type:
System.Nullable<DateTime>
The first date/time.
- timeValue2
-
Type:
System.Nullable<DateTime>
The second date/time.
Return Value
Type: System.Nullable<Int32>The number of hours between the first and second date/times.
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.
DbFunctions.DiffHours Method (Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)
When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two date/times.
[DbFunctionAttribute("Edm", "DiffHours")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue2")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue1")] public static Nullable<int> DiffHours( Nullable<DateTimeOffset> timeValue1, Nullable<DateTimeOffset> timeValue2 )
Parameters
- timeValue1
-
Type:
System.Nullable<DateTimeOffset>
The first date/time.
- timeValue2
-
Type:
System.Nullable<DateTimeOffset>
The second date/time.
Return Value
Type: System.Nullable<Int32>The number of hours between the first and second date/times.
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.
DbFunctions.DiffHours Method (Nullable<TimeSpan>, Nullable<TimeSpan>)
When used as part of a LINQ to Entities query, this method invokes the canonical DiffHours EDM function to calculate the number of hours between two time spans.
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue2")] [DbFunctionAttribute("Edm", "DiffHours")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue1")] public static Nullable<int> DiffHours( Nullable<TimeSpan> timeValue1, Nullable<TimeSpan> timeValue2 )
Parameters
- timeValue1
-
Type:
System.Nullable<TimeSpan>
The first time span.
- timeValue2
-
Type:
System.Nullable<TimeSpan>
The second time span.
Return Value
Type: System.Nullable<Int32>The number of hours between the first and second time spans.
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.