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


C# GregorianCalendar.ToDateTime方法代码示例

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


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

示例1: PosTest1

 public void PosTest1()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     System.Globalization.Calendar gc = new GregorianCalendar();
     DateTime desiretdDT = gc.ToDateTime(1, 1, 1, 0, 0, 0, 0);
     Assert.Equal(tbc.MinSupportedDateTime, desiretdDT);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:ThaiBuddhistCalendarMinSupportedDateTime.cs

示例2: PosTest1

 public void PosTest1()
 {
     System.Globalization.Calendar tc = new TaiwanCalendar();
     System.Globalization.Calendar gc = new GregorianCalendar();
     DateTime desiredDT = gc.ToDateTime(1912, 1, 1, 0, 0, 0, 0);
     Assert.Equal(desiredDT, tc.MinSupportedDateTime);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:TaiwanCalendarMinSupportedDateTime.cs

示例3: PosTest1

 public void PosTest1()
 {
     System.Globalization.Calendar tc = new TaiwanCalendar();
     System.Globalization.Calendar gc = new GregorianCalendar();
     DateTime desiretdDT = gc.ToDateTime(9999, 12, 31, 23, 59, 59, 999);
     desiretdDT = desiretdDT.AddTicks(9999);
     Assert.Equal(desiretdDT, tc.MaxSupportedDateTime);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:8,代码来源:TaiwanCalendarMaxSupportedDateTime.cs

示例4: PosTest1

 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(1, 1, 1, 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

示例5: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2008, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetWeekOfYear(dateTime, new CultureInfo("en-US").DateTimeFormat.CalendarWeekRule, new CultureInfo("en-US").DateTimeFormat.FirstDayOfWeek);
     int actualValue;
     actualValue = kC.GetWeekOfYear(kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day, 0, 0, 0, 0), new CultureInfo("ko-KR").DateTimeFormat.CalendarWeekRule, new CultureInfo("ko-KR").DateTimeFormat.FirstDayOfWeek);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetWeekOfYear.cs

示例6: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2008, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetYear(dateTime) + 2333;
     int actualValue;
     actualValue = kC.GetYear(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetYear.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 expectedValue = gC.GetDayOfYear(dateTime);
     int actualValue;
     actualValue = kC.GetDayOfYear(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:10,代码来源:KoreanCalendarGetDayOfYear.cs

示例8: PosTest4

 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(TestLibrary.Generator.GetInt64(-55) % (DateTime.MaxValue.Ticks + 1));
     dateTime = gC.ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int expectedValue = gC.GetDayOfYear(dateTime);
     int actualValue;
     actualValue = kC.GetDayOfYear(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:KoreanCalendarGetDayOfYear.cs

示例9: PosTest5

 public void PosTest5()
 {
     DateTime initialTime;
     int years;
     DateTime resultingTime;
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     years = 13;
     initialTime = myCalendar.ToDateTime(2000, 2, 29, 10, 30, 24, 0);
     resultingTime = myCalendar.AddYears(initialTime, years);
     VerifyAddyearsResult(myCalendar, initialTime, resultingTime, years);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:11,代码来源:GregorianCalendarAddYears.cs

示例10: 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

示例11: PosTest4

 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     Int64 ticks = _generator.GetInt64(-55) % DateTime.MaxValue.Ticks + 1;
     DateTime dateTime = new DateTime(ticks);
     dateTime = gC.ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int expectedValue = gC.GetWeekOfYear(dateTime, new CultureInfo("en-US").DateTimeFormat.CalendarWeekRule, new CultureInfo("en-US").DateTimeFormat.FirstDayOfWeek);
     int actualValue;
     actualValue = kC.GetWeekOfYear(kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day, 0, 0, 0, 0), new CultureInfo("ko-KR").DateTimeFormat.CalendarWeekRule, new CultureInfo("ko-KR").DateTimeFormat.FirstDayOfWeek);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:12,代码来源:KoreanCalendarGetWeekOfYear.cs

示例12: 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

示例13: PosTest3

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

示例14: PosTest1

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

示例15: PosTest4

 public void PosTest4()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month;
     DateTime time;
     int expectedMonth, actualMonth;
     year = GetACommonYear(myCalendar);
     //Get a random value beween 1 and 12 not including 2.
     do
     {
         month = TestLibrary.Generator.GetInt32(-55) % 12 + 1;
     } while (2 == month);
     time = myCalendar.ToDateTime(year, month, 28, 10, 30, 20, 0);
     expectedMonth = month;
     actualMonth = myCalendar.GetMonth(time);
     Assert.Equal(expectedMonth, actualMonth);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:17,代码来源:GregorianCalendarGetMonth.cs


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