本文整理汇总了C#中LocalDateTime.PlusMonths方法的典型用法代码示例。如果您正苦于以下问题:C# LocalDateTime.PlusMonths方法的具体用法?C# LocalDateTime.PlusMonths怎么用?C# LocalDateTime.PlusMonths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalDateTime
的用法示例。
在下文中一共展示了LocalDateTime.PlusMonths方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlusMonths_Simple
public void PlusMonths_Simple()
{
var calendar = CalendarSystem.GetIslamicCalendar(IslamicLeapYearPattern.Base15, IslamicEpoch.Civil);
Assert.IsTrue(calendar.IsLeapYear(2));
LocalDateTime start = new LocalDateTime(2, 12, 30, 2, 0, calendar);
LocalDateTime expectedEnd = new LocalDateTime(3, 11, 30, 2, 0, calendar);
Assert.AreEqual(11, expectedEnd.Month);
Assert.AreEqual(30, expectedEnd.Day);
Assert.AreEqual(expectedEnd, start.PlusMonths(11));
}
示例2: PlusMonth_ChangingYear
public void PlusMonth_ChangingYear()
{
LocalDateTime start = new LocalDateTime(2012, 10, 15, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2013, 2, 15, 12, 15, 8);
Assert.AreEqual(expected, start.PlusMonths(4));
}
示例3: PlusMonth_WithTruncation
public void PlusMonth_WithTruncation()
{
LocalDateTime start = new LocalDateTime(2011, 1, 30, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2011, 2, 28, 12, 15, 8);
Assert.AreEqual(expected, start.PlusMonths(1));
}
示例4: PlusMonth_Simple
public void PlusMonth_Simple()
{
LocalDateTime start = new LocalDateTime(2012, 4, 15, 12, 15, 8);
LocalDateTime expected = new LocalDateTime(2012, 8, 15, 12, 15, 8);
Assert.AreEqual(expected, start.PlusMonths(4));
}