SqlMethods.DateDiffDay 方法

定义

计算两个指定日期之间的日边界数。

重载

名称 说明
DateDiffDay(DateTime, DateTime)

计算两个不可为 null 的日期之间的日期边界数。

DateDiffDay(DateTimeOffset, DateTimeOffset)

计算两个不可为 null 的日期之间的日期边界数。

DateDiffDay(Nullable<DateTime>, Nullable<DateTime>)

计算两个可为空日期之间的日期边界数。

DateDiffDay(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

计算两个可为空日期之间的日期边界数。

注解

对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server day 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF

DateDiffDay(DateTime, DateTime)

计算两个不可为 null 的日期之间的日期边界数。

public:
 static int DateDiffDay(DateTime startDate, DateTime endDate);
public static int DateDiffDay(DateTime startDate, DateTime endDate);
static member DateDiffDay : DateTime * DateTime -> int
Public Shared Function DateDiffDay (startDate As DateTime, endDate As DateTime) As Integer

参数

startDate
DateTime

时间段的开始日期。

endDate
DateTime

时间段的结束日期。

返回

两个指定日期之间的日边界数。

注解

对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server day 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF

适用于

DateDiffDay(DateTimeOffset, DateTimeOffset)

计算两个不可为 null 的日期之间的日期边界数。

public:
 static int DateDiffDay(DateTimeOffset startDate, DateTimeOffset endDate);
public static int DateDiffDay(DateTimeOffset startDate, DateTimeOffset endDate);
static member DateDiffDay : DateTimeOffset * DateTimeOffset -> int
Public Shared Function DateDiffDay (startDate As DateTimeOffset, endDate As DateTimeOffset) As Integer

参数

startDate
DateTimeOffset

时间段的开始日期。

endDate
DateTimeOffset

时间段的结束日期。

返回

两个指定日期之间的日边界数。

注解

对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server day 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF

适用于

DateDiffDay(Nullable<DateTime>, Nullable<DateTime>)

计算两个可为空日期之间的日期边界数。

public:
 static Nullable<int> DateDiffDay(Nullable<DateTime> startDate, Nullable<DateTime> endDate);
public static int? DateDiffDay(DateTime? startDate, DateTime? endDate);
static member DateDiffDay : Nullable<DateTime> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiffDay (startDate As Nullable(Of DateTime), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

参数

startDate
Nullable<DateTime>

时间段的开始日期。

endDate
Nullable<DateTime>

时间段的结束日期。

返回

如果两个参数都不是 null,则返回两个指定日期之间的日边界数。 当一个或两个参数都是 null时,返回一个 null 值。

注解

对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server day 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF

适用于

DateDiffDay(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

计算两个可为空日期之间的日期边界数。

public:
 static Nullable<int> DateDiffDay(Nullable<DateTimeOffset> startDate, Nullable<DateTimeOffset> endDate);
public static int? DateDiffDay(DateTimeOffset? startDate, DateTimeOffset? endDate);
static member DateDiffDay : Nullable<DateTimeOffset> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiffDay (startDate As Nullable(Of DateTimeOffset), endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

参数

startDate
Nullable<DateTimeOffset>

时间段的开始日期。

endDate
Nullable<DateTimeOffset>

时间段的结束日期。

返回

如果两个参数都不是 null,则返回两个指定日期之间的日边界数。 当一个或两个参数都是 null时,返回一个 null 值。

注解

对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server day 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF

适用于