SqlFunctions.DateDiff Method

 

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

Namespace:   System.Data.Entity.SqlServer
Assembly:  EntityFramework.SqlServer (in EntityFramework.SqlServer.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, Nullable<DateTime>, Nullable<DateTime>)

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

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

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

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

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, Nullable<DateTime>, String)

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

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

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

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

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

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

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, Nullable<DateTimeOffset>, String)

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

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

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

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

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

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

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, Nullable<TimeSpan>, String)

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, String, Nullable<DateTime>)

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, String, Nullable<DateTimeOffset>)

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, String, Nullable<TimeSpan>)

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

System_CAPS_pubmethodSystem_CAPS_staticDateDiff(String, String, String)

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


SqlFunctions.DateDiff Method (String, Nullable<DateTime>, Nullable<DateTime>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTime> startDate,
	Nullable<DateTime> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTime>

The first date.

endDate
Type: System.Nullable<DateTime>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTime>, Nullable<DateTimeOffset>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTime> startDate,
	Nullable<DateTimeOffset> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTime>

The first date.

endDate
Type: System.Nullable<DateTimeOffset>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTime>, Nullable<TimeSpan>)

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

[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTime> startDate,
	Nullable<TimeSpan> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTime>

The first date.

endDate
Type: System.Nullable<TimeSpan>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTime>, String)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTime> startDate,
	string endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTime>

The first date.

endDate
Type: System.String

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTimeOffset>, Nullable<DateTime>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTimeOffset> startDate,
	Nullable<DateTime> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTimeOffset>

The first date.

endDate
Type: System.Nullable<DateTime>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTimeOffset> startDate,
	Nullable<DateTimeOffset> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTimeOffset>

The first date.

endDate
Type: System.Nullable<DateTimeOffset>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTimeOffset>, Nullable<TimeSpan>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTimeOffset> startDate,
	Nullable<TimeSpan> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTimeOffset>

The first date.

endDate
Type: System.Nullable<TimeSpan>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two Dates.


SqlFunctions.DateDiff Method (String, Nullable<DateTimeOffset>, String)

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

[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<DateTimeOffset> startDate,
	string endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<DateTimeOffset>

The first date.

endDate
Type: System.String

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<TimeSpan>, Nullable<DateTime>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<TimeSpan> startDate,
	Nullable<DateTime> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<TimeSpan>

The first date.

endDate
Type: System.Nullable<DateTime>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<TimeSpan>, Nullable<DateTimeOffset>)

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

[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<TimeSpan> startDate,
	Nullable<DateTimeOffset> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<TimeSpan>

The first date.

endDate
Type: System.Nullable<DateTimeOffset>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<TimeSpan>, Nullable<TimeSpan>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<TimeSpan> startDate,
	Nullable<TimeSpan> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<TimeSpan>

The first date.

endDate
Type: System.Nullable<TimeSpan>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, Nullable<TimeSpan>, String)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	Nullable<TimeSpan> startDate,
	string endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.Nullable<TimeSpan>

The first date.

endDate
Type: System.String

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, String, Nullable<DateTime>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	string startDate,
	Nullable<DateTime> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.String

The first date.

endDate
Type: System.Nullable<DateTime>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, String, Nullable<DateTimeOffset>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	string startDate,
	Nullable<DateTimeOffset> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.String

The first date.

endDate
Type: System.Nullable<DateTimeOffset>

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.


SqlFunctions.DateDiff Method (String, String, Nullable<TimeSpan>)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
public static Nullable<int> DateDiff(
	string datePartArg,
	string startDate,
	Nullable<TimeSpan> endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.String

The first date.

endDate
Type: System.Nullable<TimeSpan>

The second date.

Return Value

Type: System.Nullable<Int32>

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


SqlFunctions.DateDiff Method (String, String, String)

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

[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "datePartArg")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "startDate")]
[DbFunctionAttribute("SqlServer", "DATEDIFF")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", 
	MessageId = "endDate")]
public static Nullable<int> DateDiff(
	string datePartArg,
	string startDate,
	string endDate
)

Parameters

datePartArg
Type: System.String

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

startDate
Type: System.String

The first date.

endDate
Type: System.String

The second date.

Return Value

Type: System.Nullable<Int32>

The number of time intervals between the two dates.