Table of Contents

Method Add

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.dll

Add(DateTime, long, DateTimeUnit)

Adds a value of the specified unit to a DateTime.

public static DateTime Add(this DateTime @this, long value, DateTimeUnit unit)

Parameters

this DateTime

The original DateTime.

value long

The value to be added.

unit DateTimeUnit

The unit.

Returns

DateTime

The resulting DateTime.

Add(DateTime, long, DateTimeUnit, string)

Adds a value of the specified unit to a DateTime taking a timezone into consideration.

public static DateTime Add(this DateTime @this, long value, DateTimeUnit unit, string timezone)

Parameters

this DateTime

The original DateTime.

value long

The value to be added.

unit DateTimeUnit

The unit.

timezone string

The timezone.

Returns

DateTime

The resulting DateTime.

Remarks

See the server documentation for $dateAdd for information on timezones in MongoDB.

Add(DateTime, TimeSpan, string)

Adds a TimeSpan value to a DateTime taking a timezone into consideration.

public static DateTime Add(this DateTime @this, TimeSpan value, string timezone)

Parameters

this DateTime

The original DateTime.

value TimeSpan

The value to be added.

timezone string

The timezone.

Returns

DateTime

The resulting DateTime.

Remarks

See the server documentation for $dateAdd for information on timezones in MongoDB.