Csharp/C Sharp by API/System/TimeZone — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:11, 26 мая 2010
Содержание
TimeZone.CurrentTimeZone
using System;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
DateTime dt1 = new DateTime(2008, 1, 1);
DateTime dt2 = new DateTime(2008, 6, 1);
Console.WriteLine(zone.IsDaylightSavingTime(dt1));
Console.WriteLine(zone.IsDaylightSavingTime(dt2));
Console.WriteLine(zone.GetUtcOffset(dt1));
Console.WriteLine(zone.GetUtcOffset(dt2));
}
}
TimeZone.DaylightName
using System;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
Console.WriteLine(zone.StandardName);
Console.WriteLine(zone.DaylightName);
}
}
TimeZone.GetDaylightChanges
using System;
using System.Globalization;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
DaylightTime day = zone.GetDaylightChanges(2008);
Console.WriteLine(day.Start);
Console.WriteLine(day.End);
Console.WriteLine(day.Delta);
}
}
TimeZone.GetUtcOffset
using System;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
DateTime dt1 = new DateTime(2008, 1, 1);
DateTime dt2 = new DateTime(2008, 6, 1);
Console.WriteLine(zone.IsDaylightSavingTime(dt1));
Console.WriteLine(zone.IsDaylightSavingTime(dt2));
Console.WriteLine(zone.GetUtcOffset(dt1));
Console.WriteLine(zone.GetUtcOffset(dt2));
}
}
TimeZone.IsDaylightSavingTime
using System;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
DateTime dt1 = new DateTime(2008, 1, 1);
DateTime dt2 = new DateTime(2008, 6, 1);
Console.WriteLine(zone.IsDaylightSavingTime(dt1));
Console.WriteLine(zone.IsDaylightSavingTime(dt2));
Console.WriteLine(zone.GetUtcOffset(dt1));
Console.WriteLine(zone.GetUtcOffset(dt2));
}
}
TimeZone.StandardName
using System;
public class MainClass {
public static void Main() {
TimeZone zone = TimeZone.CurrentTimeZone;
Console.WriteLine(zone.StandardName);
Console.WriteLine(zone.DaylightName);
}
}