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


C# GregorianCalendar.GetEra方法代码示例

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


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

示例1: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2004, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetMonthsInYear.cs

示例2: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new GregorianCalendar().ToDateTime(9999, 12, 31, 0, 0, 0, 0);
     int expectedValue = gC.GetDaysInMonth(dateTime.Year, dateTime.Month, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetDaysInMonth(dateTime.Year + 2333, dateTime.Month, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetDaysInMonth.cs

示例3: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc);
     int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetMonthsInYear.cs

示例4: PosTest4

 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(1200, 2, 29, 0, 0, 0, 0);
     int year = dateTime.Year;
     int era = gC.GetEra(dateTime);
     bool expectedValue = gC.IsLeapYear(year, era);
     bool actualValue;
     actualValue = kC.IsLeapYear(year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:12,代码来源:KoreanCalendarIsLeapYear.cs

示例5: PosTest4

 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(_generator.GetInt64(-55) % (DateTime.MaxValue.Ticks + 1));
     dateTime = new GregorianCalendar().ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int month = _generator.GetInt16(-55) % 12 + 1;
     int expectedValue = gC.GetDaysInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetDaysInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:12,代码来源:KoreanCalendarGetDaysInYear.cs

示例6: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month;
     DateTime time;
     int expectedEra, actualEra;
     year = GetACommonYear(myCalendar);
     month = 2;
     time = myCalendar.ToDateTime(year, month, 28, 10, 20, 30, 0);
     expectedEra = c_AD_ERA;
     actualEra = myCalendar.GetEra(time);
     Assert.Equal(expectedEra, actualEra);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:GregorianCalendarGetEra.cs

示例7: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(9999, 12, 31, 0, 0, 0, 0);
     int year = dateTime.Year;
     int month = dateTime.Month;
     int era = gC.GetEra(dateTime);
     bool expectedValue = gC.IsLeapMonth(year, month, era);
     bool actualValue;
     actualValue = kC.IsLeapMonth(year + 2333, month, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:13,代码来源:KoreanCalendarIsLeapMonth.cs

示例8: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month;
     DateTime time;
     int expectedEra, actualEra;
     year = GetALeapYear(myCalendar);
     //Get a random value beween 1 and 12 not including 2.
     do
     {
         month = _generator.GetInt32(-55) % 12 + 1;
     } while (2 == month);
     time = myCalendar.ToDateTime(year, month, 28, 10, 30, 20, 0);
     expectedEra = c_AD_ERA;
     actualEra = myCalendar.GetEra(time);
     Assert.Equal(expectedEra, actualEra);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:17,代码来源:GregorianCalendarGetEra.cs

示例9: PosTest5

 public void PosTest5()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month;
     DateTime time;
     int expectedEra, actualEra;
     year = myCalendar.MinSupportedDateTime.Year;
     month = _generator.GetInt32(-55) % 12 + 1;
     time = myCalendar.ToDateTime(year, month, 20, 8, 20, 30, 0);
     expectedEra = c_AD_ERA;
     actualEra = myCalendar.GetEra(time);
     Assert.Equal(expectedEra, actualEra);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:GregorianCalendarGetEra.cs


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