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
thisDateTimeThe original DateTime.
valuelongThe value to be added.
unitDateTimeUnitThe 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
thisDateTimeThe original DateTime.
valuelongThe value to be added.
unitDateTimeUnitThe unit.
timezonestringThe 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
thisDateTimeThe original DateTime.
valueTimeSpanThe value to be added.
timezonestringThe timezone.
Returns
- DateTime
The resulting DateTime.
Remarks
See the server documentation for $dateAdd for information on timezones in MongoDB.