当前位置: 首页>>代码示例>>C#>>正文


C# DateTime.EndOfYear方法代码示例

本文整理汇总了C#中System.DateTime.EndOfYear方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.EndOfYear方法的具体用法?C# DateTime.EndOfYear怎么用?C# DateTime.EndOfYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.EndOfYear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EndOfYearTestCase2

 public void EndOfYearTestCase2()
 {
     var dateTime = new DateTime( 9999, 12, 31 );
     var expected = new DateTime( 9999, 12, 31, 23, 59, 59, 999 );
     var actual = dateTime.EndOfYear();
     Assert.AreEqual( expected, actual );
 }
开发者ID:MannusEtten,项目名称:Extend,代码行数:7,代码来源:DateTime.EndOfYear.Test.cs

示例2: EndOfYearTestCase1

 public void EndOfYearTestCase1()
 {
     var dateTime = new DateTime( 1, 1, 1 );
     var expected = new DateTime( dateTime.Year, 1, 1 ).AddYears( 1 )
                                                       .Subtract( 1.ToMilliseconds() );
     var actual = dateTime.EndOfYear();
     Assert.AreEqual( expected, actual );
 }
开发者ID:MannusEtten,项目名称:Extend,代码行数:8,代码来源:DateTime.EndOfYear.Test.cs

示例3: MsYear

 /// <summary>
 /// creates a new msYear object for the year containing the date
 /// </summary>
 /// <param name="date">date within the year</param>
 public MsYear(DateTime date)
 {
     #if NET20
     StartDate = MsDateHelpers.StartOfYear(date);
     EndDate = MsDateHelpers.EndOfYear(date);
     #else
     StartDate = date.StartOfYear();
     EndDate = date.EndOfYear();
     #endif
 }
开发者ID:pdesterlich,项目名称:msUtilities,代码行数:14,代码来源:msYear.cs

示例4: EndOfYear

        public void EndOfYear()
        {
            // Type
            var @this = new DateTime(2013, 04, 13);

            // Examples
            DateTime value = @this.EndOfYear(); // value = "2013/12/31 23:59:59:999";

            // Unit Test
            Assert.AreEqual(new DateTime(2013, 12, 31, 23, 59, 59, 999), value);
        }
开发者ID:fqybzhangji,项目名称:Z.ExtensionMethods,代码行数:11,代码来源:DateTime.EndOfYear.cs

示例5: EndOfYearWithCalendarShouldReturnExpectedResult

 public void EndOfYearWithCalendarShouldReturnExpectedResult()
 {
     var date = new DateTime( 2013, 3, 1 );
     var calendar = new GregorianFiscalCalendar( 7 );
     var expected = new DateTime( 2013, 6, 30 ); // because fiscal calendar starts in July
     var actual = date.EndOfYear( calendar );
     Assert.Equal( expected.Date, actual.Date );
 }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:8,代码来源:DateTimeExtensionsTest.cs

示例6: EndOfYearShouldReturnExpectedResult

 public void EndOfYearShouldReturnExpectedResult()
 {
     var date = new DateTime( 2013, 3, 1 );
     var expected = new DateTime( 2013, 12, 31 );
     var actual = date.EndOfYear();
     Assert.Equal( expected.Date, actual.Date );
 }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:7,代码来源:DateTimeExtensionsTest.cs

示例7: EndOfYear

        public static DateTime EndOfYear( this Calendar calendar, DateTime date )
        {
            Arg.NotNull( calendar, nameof( calendar ) );
            Contract.Ensures( calendar.GetYear( Contract.Result<DateTime>() ) == Contract.OldValue( calendar.GetYear( date ) ) );

            return date.EndOfYear( calendar );
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:7,代码来源:CalendarExtensions.cs


注:本文中的System.DateTime.EndOfYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。