Method Add
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
DateTimeThe original DateTime.
value
longThe value to be added.
unit
DateTimeUnitThe 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
DateTimeThe original DateTime.
value
longThe value to be added.
unit
DateTimeUnitThe unit.
timezone
stringThe 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
DateTimeThe original DateTime.
value
TimeSpanThe value to be added.
timezone
stringThe timezone.
Returns
- DateTime
The resulting DateTime.
Remarks
See the server documentation for $dateAdd for information on timezones in MongoDB.