DbFunctions.AddDays Method (Nullable<DateTime>, Nullable<Int32>)

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

When used as part of a LINQ to Entities query, this method invokes the canonical AddDays EDM function to add the given number of days to a date/time.

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

Syntax

'Declaration
<DbFunctionAttribute("Edm", "AddDays")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "addValue")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "dateValue")> _
Public Shared Function AddDays ( _
    dateValue As Nullable(Of DateTime), _
    addValue As Nullable(Of Integer) _
) As Nullable(Of DateTime)
'Usage
Dim dateValue As Nullable(Of DateTime)
Dim addValue As Nullable(Of Integer)
Dim returnValue As Nullable(Of DateTime)

returnValue = DbFunctions.AddDays(dateValue, _
    addValue)
[DbFunctionAttribute("Edm", "AddDays")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "addValue")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")]
public static Nullable<DateTime> AddDays(
    Nullable<DateTime> dateValue,
    Nullable<int> addValue
)
[DbFunctionAttribute(L"Edm", L"AddDays")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"addValue")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"dateValue")]
public:
static Nullable<DateTime> AddDays(
    Nullable<DateTime> dateValue, 
    Nullable<int> addValue
)
[<DbFunctionAttribute("Edm", "AddDays")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "addValue")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")>]
static member AddDays : 
        dateValue:Nullable<DateTime> * 
        addValue:Nullable<int> -> Nullable<DateTime> 
public static function AddDays(
    dateValue : Nullable<DateTime>, 
    addValue : Nullable<int>
) : Nullable<DateTime>

Parameters

Return Value

Type: System.Nullable<DateTime>
A resulting date/time.

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.

See Also

Reference

DbFunctions Class

AddDays Overload

System.Data.Entity Namespace