SqlFunctions.DateDiff 方法

定义

返回两个指定日期之间所跨的日期和时间边界的数目。Returns the number of date and time boundaries crossed between two specified dates.

重载

DateDiff(String, String, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, String, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, String, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, String, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<TimeSpan>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<TimeSpan>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<TimeSpan>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<TimeSpan>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTimeOffset>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTimeOffset>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTimeOffset>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTime>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTime>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTime>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

DateDiff(String, Nullable<DateTime>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, String, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, System::String ^ startDate, System::String ^ endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, string startDate, string endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * string * string -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As String, endDate As String) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
String

第一个日期。The first date.

endDate
String

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, String, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, System::String ^ startDate, Nullable<TimeSpan> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, string startDate, TimeSpan? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * string * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As String, endDate As Nullable(Of TimeSpan)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
String

第一个日期。The first date.

endDate
Nullable<TimeSpan>

第二个日期。The second date.

返回

Nullable<Int32>

指定两个日期之间的时间间隔数的值。The value specifying the number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, String, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, System::String ^ startDate, Nullable<DateTimeOffset> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, string startDate, DateTimeOffset? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * string * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As String, endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
String

第一个日期。The first date.

endDate
Nullable<DateTimeOffset>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, String, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, System::String ^ startDate, Nullable<DateTime> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, string startDate, DateTime? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * string * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As String, endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
String

第一个日期。The first date.

endDate
Nullable<DateTime>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<TimeSpan>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<TimeSpan> startDate, System::String ^ endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, TimeSpan? startDate, string endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<TimeSpan> * string -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of TimeSpan), endDate As String) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<TimeSpan>

第一个日期。The first date.

endDate
String

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<TimeSpan>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<TimeSpan> startDate, Nullable<TimeSpan> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, TimeSpan? startDate, TimeSpan? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<TimeSpan> * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of TimeSpan), endDate As Nullable(Of TimeSpan)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<TimeSpan>

第一个日期。The first date.

endDate
Nullable<TimeSpan>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<TimeSpan>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<TimeSpan> startDate, Nullable<DateTimeOffset> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, TimeSpan? startDate, DateTimeOffset? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<TimeSpan> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of TimeSpan), endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<TimeSpan>

第一个日期。The first date.

endDate
Nullable<DateTimeOffset>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<TimeSpan>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<TimeSpan> startDate, Nullable<DateTime> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, TimeSpan? startDate, DateTime? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<TimeSpan> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of TimeSpan), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<TimeSpan>

第一个日期。The first date.

endDate
Nullable<DateTime>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTimeOffset> startDate, Nullable<DateTimeOffset> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTimeOffset? startDate, DateTimeOffset? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTimeOffset), endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTimeOffset>

第一个日期。The first date.

endDate
Nullable<DateTimeOffset>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTimeOffset>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTimeOffset> startDate, Nullable<TimeSpan> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTimeOffset? startDate, TimeSpan? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTimeOffset> * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTimeOffset), endDate As Nullable(Of TimeSpan)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTimeOffset>

第一个日期。The first date.

endDate
Nullable<TimeSpan>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two Dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTimeOffset>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTimeOffset> startDate, System::String ^ endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTimeOffset? startDate, string endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTimeOffset> * string -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTimeOffset), endDate As String) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTimeOffset>

第一个日期。The first date.

endDate
String

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTimeOffset>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTimeOffset> startDate, Nullable<DateTime> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTimeOffset? startDate, DateTime? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTimeOffset> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTimeOffset), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTimeOffset>

第一个日期。The first date.

endDate
Nullable<DateTime>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTime>, String)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTime> startDate, System::String ^ endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTime? startDate, string endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTime> * string -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTime), endDate As String) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTime>

第一个日期。The first date.

endDate
String

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTime>, Nullable<TimeSpan>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTime> startDate, Nullable<TimeSpan> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTime? startDate, TimeSpan? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTime> * Nullable<TimeSpan> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTime), endDate As Nullable(Of TimeSpan)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTime>

第一个日期。The first date.

endDate
Nullable<TimeSpan>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTime>, Nullable<DateTimeOffset>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTime> startDate, Nullable<DateTimeOffset> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTime? startDate, DateTimeOffset? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTime> * Nullable<DateTimeOffset> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTime), endDate As Nullable(Of DateTimeOffset)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTime>

第一个日期。The first date.

endDate
Nullable<DateTimeOffset>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, Nullable<DateTime>, Nullable<DateTime>)

返回所指定开始日期和结束日期之间的指定 datepart 边界的计数。Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

public:
 static Nullable<int> DateDiff(System::String ^ datePartArg, Nullable<DateTime> startDate, Nullable<DateTime> endDate);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")]
public static int? DateDiff (string datePartArg, DateTime? startDate, DateTime? endDate);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEDIFF")>]
static member DateDiff : string * Nullable<DateTime> * Nullable<DateTime> -> Nullable<int>
Public Shared Function DateDiff (datePartArg As String, startDate As Nullable(Of DateTime), endDate As Nullable(Of DateTime)) As Nullable(Of Integer)

参数

datePartArg
String

要计算时间间隔差值的日期部分。The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTime>

第一个日期。The first date.

endDate
Nullable<DateTime>

第二个日期。The second date.

返回

Nullable<Int32>

两个日期之间的时间间隔数。The number of time intervals between the two dates.

属性

注解

不能直接调用此函数。You cannot call this function directly. 此函数只能出现在 LINQ to Entities 查询中。This function can only appear within a LINQ to Entities query.

此函数已转换为数据库中的相应函数。This function is translated to a corresponding function in the database. 有关相应 SQL Server 函数的信息,请参阅 DATEDIFF (transact-sql) 。For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

适用于