SqlFunctions.DateDiff SqlFunctions.DateDiff SqlFunctions.DateDiff SqlFunctions.DateDiff Method

Definition

Returns the number of date and time boundaries crossed between two specified dates.

Overloads

DateDiff(String, String, String) DateDiff(String, String, String) DateDiff(String, String, String) DateDiff(String, String, String)

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

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

Returns the count of the specified datepart boundaries crossed between the specified start date and end date.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

DateDiff(String, String, String) DateDiff(String, String, String) DateDiff(String, String, String) DateDiff(String, String, String)

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 Nullable<int> DateDiff (string datePartArg, string startDate, string endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
String String String String

The first date.

endDate
String String String String

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, string startDate, Nullable<TimeSpan> endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
String String String String

The first date.

endDate
Nullable<TimeSpan>

The second date.

Returns

The value specifying the number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, string startDate, Nullable<DateTimeOffset> endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
String String String String

The first date.

endDate
Nullable<DateTimeOffset>

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, string startDate, Nullable<DateTime> endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
String String String String

The first date.

endDate
Nullable<DateTime>

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<TimeSpan> startDate, string endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
Nullable<TimeSpan>

The first date.

endDate
String String String String

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<TimeSpan> startDate, Nullable<TimeSpan> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<TimeSpan> startDate, Nullable<DateTimeOffset> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<TimeSpan> startDate, Nullable<DateTime> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTimeOffset> startDate, Nullable<DateTimeOffset> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTimeOffset> startDate, Nullable<TimeSpan> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two Dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTimeOffset> startDate, string endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTimeOffset>

The first date.

endDate
String String String String

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTimeOffset> startDate, Nullable<DateTime> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTime> startDate, string endDate);
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)

Parameters

datePartArg
String String String String

The part of the date to calculate the differing number of time intervals.

startDate
Nullable<DateTime>

The first date.

endDate
String String String String

The second date.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTime> startDate, Nullable<TimeSpan> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTime> startDate, Nullable<DateTimeOffset> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

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

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 Nullable<int> DateDiff (string datePartArg, Nullable<DateTime> startDate, Nullable<DateTime> endDate);
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)

Parameters

datePartArg
String String String 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.

Returns

The number of time intervals between the two dates.

Remarks

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. For information about the corresponding SQL Server function, see DATEDIFF (Transact-SQL).

Applies to