SqlFunctions.DateAdd Method

Definition

Returns a new datetime value based on adding an interval to the specified date.

Overloads

DateAdd(String, Nullable<Double>, String)

Returns a new datetime value based on adding an interval to the specified date.

DateAdd(String, Nullable<Double>, Nullable<TimeSpan>)

Returns a new time span value based on adding an interval to the specified time span.

DateAdd(String, Nullable<Double>, Nullable<DateTimeOffset>)

Returns a new date value based on adding an interval to the specified date.

DateAdd(String, Nullable<Double>, Nullable<DateTime>)

Returns a new datetime value based on adding an interval to the specified 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 DATEADD (Transact-SQL).

DateAdd(String, Nullable<Double>, String)

Returns a new datetime value based on adding an interval to the specified date.

public:
 static Nullable<DateTime> DateAdd(System::String ^ datePartArg, Nullable<double> number, System::String ^ date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")]
public static DateTime? DateAdd (string datePartArg, double? number, string date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")>]
static member DateAdd : string * Nullable<double> * string -> Nullable<DateTime>
Public Shared Function DateAdd (datePartArg As String, number As Nullable(Of Double), date As String) As Nullable(Of DateTime)

Parameters

datePartArg
String

The part of the date to increment.

number
Nullable<Double>

The value used to increment a date by a specified amount.

date
String

The date to increment.

Returns

A Nullable<T> of DateTime value that is the new date.

Attributes

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 DATEADD (Transact-SQL).

Applies to

DateAdd(String, Nullable<Double>, Nullable<TimeSpan>)

Returns a new time span value based on adding an interval to the specified time span.

public:
 static Nullable<TimeSpan> DateAdd(System::String ^ datePartArg, Nullable<double> number, Nullable<TimeSpan> time);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")]
public static TimeSpan? DateAdd (string datePartArg, double? number, TimeSpan? time);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")>]
static member DateAdd : string * Nullable<double> * Nullable<TimeSpan> -> Nullable<TimeSpan>
Public Shared Function DateAdd (datePartArg As String, number As Nullable(Of Double), time As Nullable(Of TimeSpan)) As Nullable(Of TimeSpan)

Parameters

datePartArg
String

The part of the date to increment.

number
Nullable<Double>

The value used to increment a date by a specified amount.

time
Nullable<TimeSpan>

The time span to increment.

Returns

The new time span.

Attributes

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 DATEADD (Transact-SQL).

Applies to

DateAdd(String, Nullable<Double>, Nullable<DateTimeOffset>)

Returns a new date value based on adding an interval to the specified date.

public:
 static Nullable<DateTimeOffset> DateAdd(System::String ^ datePartArg, Nullable<double> number, Nullable<DateTimeOffset> dateTimeOffsetArg);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")]
public static DateTimeOffset? DateAdd (string datePartArg, double? number, DateTimeOffset? dateTimeOffsetArg);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")>]
static member DateAdd : string * Nullable<double> * Nullable<DateTimeOffset> -> Nullable<DateTimeOffset>
Public Shared Function DateAdd (datePartArg As String, number As Nullable(Of Double), dateTimeOffsetArg As Nullable(Of DateTimeOffset)) As Nullable(Of DateTimeOffset)

Parameters

datePartArg
String

The part of the date to increment.

number
Nullable<Double>

The value used to increment a date by a specified amount.

dateTimeOffsetArg
Nullable<DateTimeOffset>

The date to increment.

Returns

The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).

Attributes

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 DATEADD (Transact-SQL).

Applies to

DateAdd(String, Nullable<Double>, Nullable<DateTime>)

Returns a new datetime value based on adding an interval to the specified date.

public:
 static Nullable<DateTime> DateAdd(System::String ^ datePartArg, Nullable<double> number, Nullable<DateTime> date);
[System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")]
public static DateTime? DateAdd (string datePartArg, double? number, DateTime? date);
[<System.Data.Objects.DataClasses.EdmFunction("SqlServer", "DATEADD")>]
static member DateAdd : string * Nullable<double> * Nullable<DateTime> -> Nullable<DateTime>
Public Shared Function DateAdd (datePartArg As String, number As Nullable(Of Double), date As Nullable(Of DateTime)) As Nullable(Of DateTime)

Parameters

datePartArg
String

The part of the date to increment.

number
Nullable<Double>

The value used to increment a date by a specified amount.

date
Nullable<DateTime>

The date to increment.

Returns

The new date.

Attributes

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 DATEADD (Transact-SQL).

Applies to