Share via


SqlServerDbFunctionsExtensions.DateDiffHour Method

Definition

Overloads

DateDiffHour(DbFunctions, TimeSpan, TimeSpan)

Counts the number of hour boundaries crossed between the startTimeSpan and endTimeSpan. Corresponds to SQL Server's DATEDIFF(hour, @startTimeSpan, @endTimeSpan).

DateDiffHour(DbFunctions, TimeOnly, TimeOnly)

Counts the number of hour boundaries crossed between the startTime and endTime. Corresponds to SQL Server's DATEDIFF(hour, @startTime, @endTime).

DateDiffHour(DbFunctions, Nullable<TimeSpan>, Nullable<TimeSpan>)

Counts the number of hour boundaries crossed between the startTimeSpan and endTimeSpan. Corresponds to SQL Server's DATEDIFF(hour, @startTimeSpan, @endTimeSpan).

DateDiffHour(DbFunctions, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, Nullable<TimeOnly>, Nullable<TimeOnly>)

Counts the number of hour boundaries crossed between the startTime and endTime. Corresponds to SQL Server's DATEDIFF(hour, @startTime, @endTime).

DateDiffHour(DbFunctions, Nullable<DateOnly>, Nullable<DateOnly>)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, DateTimeOffset, DateTimeOffset)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, DateTime, DateTime)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, DateOnly, DateOnly)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, Nullable<DateTime>, Nullable<DateTime>)

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

DateDiffHour(DbFunctions, TimeSpan, TimeSpan)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startTimeSpan and endTimeSpan. Corresponds to SQL Server's DATEDIFF(hour, @startTimeSpan, @endTimeSpan).

public static int DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, TimeSpan startTimeSpan, TimeSpan endTimeSpan);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * TimeSpan * TimeSpan -> int
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startTimeSpan As TimeSpan, endTimeSpan As TimeSpan) As Integer

Parameters

_
DbFunctions

The DbFunctions instance.

startTimeSpan
TimeSpan

Starting timespan for the calculation.

endTimeSpan
TimeSpan

Ending timespan for the calculation.

Returns

Number of hour boundaries crossed between the timespans.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, TimeOnly, TimeOnly)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startTime and endTime. Corresponds to SQL Server's DATEDIFF(hour, @startTime, @endTime).

public static int DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, TimeOnly startTime, TimeOnly endTime);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * TimeOnly * TimeOnly -> int
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startTime As TimeOnly, endTime As TimeOnly) As Integer

Parameters

_
DbFunctions

The DbFunctions instance.

startTime
TimeOnly

Starting time for the calculation.

endTime
TimeOnly

Ending time for the calculation.

Returns

Number of hour boundaries crossed between the times.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, Nullable<TimeSpan>, Nullable<TimeSpan>)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startTimeSpan and endTimeSpan. Corresponds to SQL Server's DATEDIFF(hour, @startTimeSpan, @endTimeSpan).

public static int? DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, TimeSpan? startTimeSpan, TimeSpan? endTimeSpan);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * Nullable<TimeSpan> * Nullable<TimeSpan> -> Nullable<int>
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startTimeSpan As Nullable(Of TimeSpan), endTimeSpan As Nullable(Of TimeSpan)) As Nullable(Of Integer)

Parameters

_
DbFunctions

The DbFunctions instance.

startTimeSpan
Nullable<TimeSpan>

Starting timespan for the calculation.

endTimeSpan
Nullable<TimeSpan>

Ending timespan for the calculation.

Returns

Number of hour boundaries crossed between the timespans.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int? DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTimeOffset? startDate, DateTimeOffset? endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> -> Nullable<int>
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As Nullable(Of DateTimeOffset), endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
Nullable<DateTimeOffset>

Starting date for the calculation.

endDate
Nullable<DateTimeOffset>

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, Nullable<TimeOnly>, Nullable<TimeOnly>)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startTime and endTime. Corresponds to SQL Server's DATEDIFF(hour, @startTime, @endTime).

public static int? DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, TimeOnly? startTime, TimeOnly? endTime);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * Nullable<TimeOnly> * Nullable<TimeOnly> -> Nullable<int>
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startTime As Nullable(Of TimeOnly), endTime As Nullable(Of TimeOnly)) As Nullable(Of Integer)

Parameters

_
DbFunctions

The DbFunctions instance.

startTime
Nullable<TimeOnly>

Starting time for the calculation.

endTime
Nullable<TimeOnly>

Ending time for the calculation.

Returns

Number of hour boundaries crossed between the times.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, Nullable<DateOnly>, Nullable<DateOnly>)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int? DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateOnly? startDate, DateOnly? endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * Nullable<DateOnly> * Nullable<DateOnly> -> Nullable<int>
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As Nullable(Of DateOnly), endDate As Nullable(Of DateOnly)) As Nullable(Of Integer)

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
Nullable<DateOnly>

Starting date for the calculation.

endDate
Nullable<DateOnly>

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, DateTimeOffset, DateTimeOffset)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTimeOffset startDate, DateTimeOffset endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * DateTimeOffset * DateTimeOffset -> int
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As DateTimeOffset, endDate As DateTimeOffset) As Integer

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
DateTimeOffset

Starting date for the calculation.

endDate
DateTimeOffset

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, DateTime, DateTime)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTime startDate, DateTime endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * DateTime * DateTime -> int
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As DateTime, endDate As DateTime) As Integer

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
DateTime

Starting date for the calculation.

endDate
DateTime

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, DateOnly, DateOnly)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateOnly startDate, DateOnly endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * DateOnly * DateOnly -> int
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As DateOnly, endDate As DateOnly) As Integer

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
DateOnly

Starting date for the calculation.

endDate
DateOnly

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

DateDiffHour(DbFunctions, Nullable<DateTime>, Nullable<DateTime>)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

Counts the number of hour boundaries crossed between the startDate and endDate. Corresponds to SQL Server's DATEDIFF(hour, @startDate, @endDate).

public static int? DateDiffHour (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTime? startDate, DateTime? endDate);
static member DateDiffHour : Microsoft.EntityFrameworkCore.DbFunctions * Nullable<DateTime> * Nullable<DateTime> -> Nullable<int>
<Extension()>
Public Function DateDiffHour (_ As DbFunctions, startDate As Nullable(Of DateTime), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

Parameters

_
DbFunctions

The DbFunctions instance.

startDate
Nullable<DateTime>

Starting date for the calculation.

endDate
Nullable<DateTime>

Ending date for the calculation.

Returns

Number of hour boundaries crossed between the dates.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to