EdmFunctions.DiffDays Method (DbExpression, DbExpression)

 

Creates a DbFunctionExpression that invokes the canonical 'DiffDays' function with the specified arguments, which must each have a DateTime or DateTimeOffset result type. The result type of dateValue1 must match the result type of dateValue2. The result type of the expression is Edm.Int32.

Namespace:   System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
Assembly:  EntityFramework (in EntityFramework.dll)

public static DbFunctionExpression DiffDays(
	this DbExpression dateValue1,
	DbExpression dateValue2
)

Parameters

dateValue1
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the first DateTime or DateTimeOffset value.

dateValue2
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the DateTime or DateTimeOffset for which the day difference from dateValue1 should be calculated.

Return Value

Type: System.Data.Entity.Core.Common.CommandTrees.DbFunctionExpression

A new DbFunctionExpression that returns the day difference between dateValue1 and dateValue2.

Exception Condition
ArgumentNullException

dateValue1 or dateValue2 is null.

ArgumentException

No overload of the canonical 'DiffDays' function accepts arguments with the result types of dateValue1 and dateValue2.