本文整理汇总了C#中System.TimeZone.GetDaylightChanges方法的典型用法代码示例。如果您正苦于以下问题:C# TimeZone.GetDaylightChanges方法的具体用法?C# TimeZone.GetDaylightChanges怎么用?C# TimeZone.GetDaylightChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.TimeZone
的用法示例。
在下文中一共展示了TimeZone.GetDaylightChanges方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EST
private void EST (TimeZone t1)
{
// It could be EST though...
//Assert.AreEqual("Eastern Standard Time", t1.StandardName, "B01");
//Assert.AreEqual("Eastern Daylight Time", t1.DaylightName, "B02");
DaylightTime d1 = t1.GetDaylightChanges (2002);
Assert.AreEqual("04/07/2002 02:00:00", d1.Start.ToString ("G"), "B03");
Assert.AreEqual("10/27/2002 02:00:00", d1.End.ToString ("G"), "B04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "B05");
DaylightTime d2 = t1.GetDaylightChanges (1996);
Assert.AreEqual("04/07/1996 02:00:00", d2.Start.ToString ("G"), "B06");
Assert.AreEqual("10/27/1996 02:00:00", d2.End.ToString ("G"), "B07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "B08");
DateTime d3 = new DateTime (2002,2,25);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "B09");
DateTime d4 = new DateTime (2002,4,8);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "B10");
DateTime d5 = new DateTime (2002,11,4);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "B11");
Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d3).Ticks, "B12");
Assert.AreEqual(-144000000000L, t1.GetUtcOffset (d4).Ticks, "B13");
Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d5).Ticks, "B14");
}
示例2: CET
private void CET (TimeZone t1)
{
Assert.AreEqual("CET", t1.StandardName, "A01");
Assert.AreEqual("CEST", t1.DaylightName, "A02");
DaylightTime d1 = t1.GetDaylightChanges (2002);
Assert.AreEqual("03/31/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "A03");
Assert.AreEqual("10/27/2002 03:00:00", d1.End.ToString ("G", CultureInfo.InvariantCulture), "A04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "A05");
DaylightTime d2 = t1.GetDaylightChanges (1996);
Assert.AreEqual("03/31/1996 02:00:00", d2.Start.ToString ("G", CultureInfo.InvariantCulture), "A06");
Assert.AreEqual("10/27/1996 03:00:00", d2.End.ToString ("G", CultureInfo.InvariantCulture), "A07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "A08");
DateTime d3 = new DateTime (2002,2,25);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "A09");
DateTime d4 = new DateTime (2002,4,2);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "A10");
DateTime d5 = new DateTime (2002,11,4);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "A11");
Assert.AreEqual(36000000000L, t1.GetUtcOffset (d3).Ticks, "A12");
Assert.AreEqual(72000000000L, t1.GetUtcOffset (d4).Ticks, "A13");
Assert.AreEqual(36000000000L, t1.GetUtcOffset (d5).Ticks, "A14");
// Test TimeZone methods with UTC DateTime in DST.
DateTime d6 = d4.ToUniversalTime ();
Assert.AreEqual(false, t1.IsDaylightSavingTime (d6), "A15");
Assert.AreEqual(0, t1.GetUtcOffset (d6).Ticks, "A16");
}
示例3: CET
private void CET (TimeZone t1)
{
Assert.AreEqual("CET", t1.StandardName, "A01");
Assert.AreEqual("CEST", t1.DaylightName, "A02");
DaylightTime d1 = t1.GetDaylightChanges (2002);
Assert.AreEqual("03/31/2002 02:00:00", d1.Start.ToString ("G"), "A03");
Assert.AreEqual("10/27/2002 03:00:00", d1.End.ToString ("G"), "A04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "A05");
DaylightTime d2 = t1.GetDaylightChanges (1996);
Assert.AreEqual("03/31/1996 02:00:00", d2.Start.ToString ("G"), "A06");
Assert.AreEqual("10/27/1996 03:00:00", d2.End.ToString ("G"), "A07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "A08");
DateTime d3 = new DateTime (2002,2,25);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "A09");
DateTime d4 = new DateTime (2002,4,2);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "A10");
DateTime d5 = new DateTime (2002,11,4);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "A11");
Assert.AreEqual(36000000000L, t1.GetUtcOffset (d3).Ticks, "A12");
Assert.AreEqual(72000000000L, t1.GetUtcOffset (d4).Ticks, "A13");
Assert.AreEqual(36000000000L, t1.GetUtcOffset (d5).Ticks, "A14");
}
示例4: EST
private void EST (TimeZone t1)
{
Assert.IsTrue("EST" == t1.StandardName || "Eastern Standard Time" == t1.StandardName, "B01");
Assert.IsTrue("EDT" == t1.DaylightName || "Eastern Daylight Time" == t1.DaylightName, "B02");
DaylightTime d1 = t1.GetDaylightChanges (2002);
Assert.AreEqual("04/07/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "B03");
Assert.AreEqual("10/27/2002 02:00:00", d1.End.ToString ("G", CultureInfo.InvariantCulture), "B04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "B05");
DaylightTime d2 = t1.GetDaylightChanges (1996);
Assert.AreEqual("04/07/1996 02:00:00", d2.Start.ToString ("G", CultureInfo.InvariantCulture), "B06");
Assert.AreEqual("10/27/1996 02:00:00", d2.End.ToString ("G", CultureInfo.InvariantCulture), "B07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "B08");
DateTime d3 = new DateTime (2002,2,25);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "B09");
DateTime d4 = new DateTime (2002,4,8);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "B10");
DateTime d5 = new DateTime (2002,11,4);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "B11");
Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d3).Ticks, "B12");
Assert.AreEqual(-144000000000L, t1.GetUtcOffset (d4).Ticks, "B13");
Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d5).Ticks, "B14");
// Test TimeZone methods with UTC DateTime in DST.
DateTime d6 = d4.ToUniversalTime ();
Assert.AreEqual(false, t1.IsDaylightSavingTime (d6), "B15");
Assert.AreEqual(0, t1.GetUtcOffset (d6).Ticks, "B16");
}
示例5: CET
private void CET (TimeZone t1)
{
AssertEquals("A01", "CET", t1.StandardName);
AssertEquals("A02", "CEST", t1.DaylightName);
DaylightTime d1 = t1.GetDaylightChanges (2002);
AssertEquals("A03", "03/31/2002 01:00:00", d1.Start.ToString ("G"));
AssertEquals("A04", "10/27/2002 01:00:00", d1.End.ToString ("G"));
AssertEquals("A05", 36000000000L, d1.Delta.Ticks);
DaylightTime d2 = t1.GetDaylightChanges (1996);
AssertEquals("A06", "03/31/1996 01:00:00", d2.Start.ToString ("G"));
AssertEquals("A07", "10/27/1996 01:00:00", d2.End.ToString ("G"));
AssertEquals("A08", 36000000000L, d2.Delta.Ticks);
DateTime d3 = new DateTime (2002,2,25);
AssertEquals("A09", false, t1.IsDaylightSavingTime (d3));
DateTime d4 = new DateTime (2002,4,2);
AssertEquals("A10", true, t1.IsDaylightSavingTime (d4));
DateTime d5 = new DateTime (2002,11,4);
AssertEquals("A11", false, t1.IsDaylightSavingTime (d5));
AssertEquals("A12", 36000000000L, t1.GetUtcOffset (d3).Ticks);
AssertEquals("A13", 72000000000L, t1.GetUtcOffset (d4).Ticks);
AssertEquals("A14", 36000000000L, t1.GetUtcOffset (d5).Ticks);
}
示例6: GMT
private void GMT (TimeZone t1) {
// Probably wont work on MS.NET, but is better than nothing. Where do
// we change our implementation to match theirs?
Assert.AreEqual("GMT", t1.StandardName, "D01");
Assert.IsTrue("BST" == t1.DaylightName || "IST" == t1.DaylightName, "D02");
DaylightTime d1 = t1.GetDaylightChanges (2002);
Assert.AreEqual("03/31/2002 01:00:00", d1.Start.ToString ("G"), "D03");
Assert.AreEqual("10/27/2002 02:00:00", d1.End.ToString ("G"), "D04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "D05");
DaylightTime d2 = t1.GetDaylightChanges (1996);
Assert.AreEqual("03/31/1996 01:00:00", d2.Start.ToString ("G"), "D06");
Assert.AreEqual("10/27/1996 02:00:00", d2.End.ToString ("G"), "D07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "D08");
DateTime d3 = new DateTime (2002,2,25);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "D09");
DateTime d4 = new DateTime (2002,4,2);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "D10");
DateTime d5 = new DateTime (2002,11,4);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "D11");
Assert.AreEqual(0L, t1.GetUtcOffset (d3).Ticks, "D12");
Assert.AreEqual(36000000000L, t1.GetUtcOffset (d4).Ticks, "D13");
Assert.AreEqual(0L, t1.GetUtcOffset (d5).Ticks, "D14");
}
示例7: NZST
private void NZST(TimeZone t1) {
Assert.AreEqual("NZST", t1.StandardName, "E01");
Assert.AreEqual("NZDT", t1.DaylightName, "E02");
DaylightTime d1 = t1.GetDaylightChanges (2013);
Assert.AreEqual("09/29/2013 02:00:00", d1.Start.ToString ("G"), "E03");
Assert.AreEqual("04/07/2013 03:00:00", d1.End.ToString ("G"), "E04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "E05");
DaylightTime d2 = t1.GetDaylightChanges (2001);
Assert.AreEqual("10/07/2001 02:00:00", d2.Start.ToString ("G"), "E06");
Assert.AreEqual("03/18/2001 03:00:00", d2.End.ToString ("G"), "E07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "E08");
DateTime d3 = new DateTime(2013,02,15);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d3), "E09");
DateTime d4 = new DateTime(2013,04,30);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d4), "E10");
DateTime d5 = new DateTime(2013,11,03);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d5), "E11");
Assert.AreEqual(36000000000L /*hour*/ * 13L, t1.GetUtcOffset (d3).Ticks, "E12");
Assert.AreEqual(36000000000L /*hour*/ * 12L, t1.GetUtcOffset (d4).Ticks, "E13");
Assert.AreEqual(36000000000L /*hour*/ * 13L, t1.GetUtcOffset (d5).Ticks, "E14");
}
示例8: NZST
private void NZST(TimeZone t1) {
Assert.AreEqual("NZST", t1.StandardName, "E01");
Assert.AreEqual("NZDT", t1.DaylightName, "E02");
DaylightTime d1 = t1.GetDaylightChanges (2013);
Assert.AreEqual("09/29/2013 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "E03");
Assert.AreEqual("04/07/2013 03:00:00", d1.End.ToString ("G", CultureInfo.InvariantCulture), "E04");
Assert.AreEqual(36000000000L, d1.Delta.Ticks, "E05");
DaylightTime d2 = t1.GetDaylightChanges (2001);
Assert.AreEqual("10/07/2001 02:00:00", d2.Start.ToString ("G", CultureInfo.InvariantCulture), "E06");
Assert.AreEqual("03/18/2001 03:00:00", d2.End.ToString ("G", CultureInfo.InvariantCulture), "E07");
Assert.AreEqual(36000000000L, d2.Delta.Ticks, "E08");
DateTime d3 = new DateTime(2013,02,15);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d3), "E09");
DateTime d4 = new DateTime(2013,04,30);
Assert.AreEqual(false, t1.IsDaylightSavingTime (d4), "E10");
DateTime d5 = new DateTime(2013,11,03);
Assert.AreEqual(true, t1.IsDaylightSavingTime (d5), "E11");
Assert.AreEqual(36000000000L /*hour*/ * 13L, t1.GetUtcOffset (d3).Ticks, "E12");
Assert.AreEqual(36000000000L /*hour*/ * 12L, t1.GetUtcOffset (d4).Ticks, "E13");
Assert.AreEqual(36000000000L /*hour*/ * 13L, t1.GetUtcOffset (d5).Ticks, "E14");
// Test TimeZone methods with UTC DateTime in DST.
DateTime d6 = d5.ToUniversalTime ();
Assert.AreEqual(false, t1.IsDaylightSavingTime (d6), "E15");
Assert.AreEqual(0, t1.GetUtcOffset (d6).Ticks, "E16");
}
示例9: FormAnnotation
public FormAnnotation()
{
InitializeComponent();
//datagridview settings
InitializeDataGridView(dataGridView1);
button_remove.Image = Resources.Im_delete;
button_add.Image = Resources.Im_plus;
button_category_select.Image = Resources.Im_next;
button_save.Image = Resources.Im_save;
button_generate.Image = Resources.Im_gear;
button_exit.Image = Resources.Im_stop;
//Initialize Time and Time Zone
localZone = TimeZone.CurrentTimeZone;
daylight = localZone.GetDaylightChanges(DateTime.Now.Year);
}