當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。