本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}