コード例 #1
0
 /// <summary>
 /// Subtracts given fortnights from the given DateTime.
 /// </summary>
 /// <param name="date">The given DateTime.</param>
 /// <param name="fortnights">Number of fortnights to be subtracted.</param>
 /// <returns>The DateTime after the given fortnights are subtracted.</returns>
 public static DateTime SubtractFortnights(this DateTime date, int fortnights)
 {
     return(date.AddFortnights(fortnights.Negate()));
 }
コード例 #2
0
        public void TestAddAddFortnights()
        {
            var day = new DateTime(2019, 11, 20);

            Assert.Equal(day.AddDays(30).Date, day.AddFortnights(2).Date);
        }
コード例 #3
0
 /// <summary>
 /// Adds one fortnight to the given DateTime.
 /// </summary>
 /// <param name="date">The given DateTime.</param>
 /// <returns>The DateTime after one fortnight is added.</returns>
 public static DateTime AddAFortnight(this DateTime date)
 {
     return(date.AddFortnights(1));
 }