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


C# TimeZone.GetDaylightChanges方法代码示例

本文整理汇总了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");
	}
开发者ID:mpareja,项目名称:mono,代码行数:27,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:caomw,项目名称:mono,代码行数:31,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:mpareja,项目名称:mono,代码行数:26,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:32,代码来源:TimeZoneTest.cs

示例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);
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:26,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:mpareja,项目名称:mono,代码行数:28,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:mpareja,项目名称:mono,代码行数:25,代码来源:TimeZoneTest.cs

示例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");
	}
开发者ID:caomw,项目名称:mono,代码行数:30,代码来源:TimeZoneTest.cs

示例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);
        }
开发者ID:katadam,项目名称:wockets,代码行数:19,代码来源:FormAnnotation.cs


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