SqlMethods.DateDiffSecond 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
计算两个指定日期之间的第二个边界数。
重载
| 名称 | 说明 |
|---|---|
| DateDiffSecond(DateTime, DateTime) |
计算两个不可为 null 的日期之间的第二个边界数。 |
| DateDiffSecond(DateTimeOffset, DateTimeOffset) |
计算两个不可为 null 的日期之间的第二个边界数。 |
| DateDiffSecond(Nullable<DateTime>, Nullable<DateTime>) |
计算两个可为 null 日期之间的第二个边界数。 |
| DateDiffSecond(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>) |
计算两个可为 null 日期之间的第二个边界数。 |
注解
对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server second 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF。
DateDiffSecond(DateTime, DateTime)
计算两个不可为 null 的日期之间的第二个边界数。
public:
static int DateDiffSecond(DateTime startDate, DateTime endDate);
public static int DateDiffSecond(DateTime startDate, DateTime endDate);
static member DateDiffSecond : DateTime * DateTime -> int
Public Shared Function DateDiffSecond (startDate As DateTime, endDate As DateTime) As Integer
参数
- startDate
- DateTime
时间段的开始日期。
- endDate
- DateTime
时间段的结束日期。
返回
两个指定日期之间的第二个边界数。
注解
对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server second 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF。
适用于
DateDiffSecond(DateTimeOffset, DateTimeOffset)
计算两个不可为 null 的日期之间的第二个边界数。
public:
static int DateDiffSecond(DateTimeOffset startDate, DateTimeOffset endDate);
public static int DateDiffSecond(DateTimeOffset startDate, DateTimeOffset endDate);
static member DateDiffSecond : DateTimeOffset * DateTimeOffset -> int
Public Shared Function DateDiffSecond (startDate As DateTimeOffset, endDate As DateTimeOffset) As Integer
参数
- startDate
- DateTimeOffset
时间段的开始日期。
- endDate
- DateTimeOffset
时间段的结束日期。
返回
两个指定日期之间的第二个边界数。
注解
对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server second 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF。
适用于
DateDiffSecond(Nullable<DateTime>, Nullable<DateTime>)
计算两个可为 null 日期之间的第二个边界数。
public:
static Nullable<int> DateDiffSecond(Nullable<DateTime> startDate, Nullable<DateTime> endDate);
public static int? DateDiffSecond(DateTime? startDate, DateTime? endDate);
static member DateDiffSecond : Nullable<DateTime> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiffSecond (startDate As Nullable(Of DateTime), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)
参数
返回
如果两个参数都不是 null,则返回两个指定日期之间的第二个边界数。 当一个或两个参数都是 null时,返回一个 null 值。
注解
对应于使用 DATEDIFF 指定跨越的时间边界类型的 SQL Server second 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF。
适用于
DateDiffSecond(Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)
计算两个可为 null 日期之间的第二个边界数。
public:
static Nullable<int> DateDiffSecond(Nullable<DateTimeOffset> startDate, Nullable<DateTimeOffset> endDate);
public static int? DateDiffSecond(DateTimeOffset? startDate, DateTimeOffset? endDate);
static member DateDiffSecond : Nullable<DateTimeOffset> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiffSecond (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 second 函数。 有关此SQL Server函数的详细信息,请参阅 DATEDIFF。