TimeZoneInfo.AdjustmentRule 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
일광 절약 시간 전환과 같은 표준 시간대 조정에 대한 정보를 제공합니다.
public: ref class TimeZoneInfo::AdjustmentRule sealed : IEquatable<TimeZoneInfo::AdjustmentRule ^>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public sealed class TimeZoneInfo.AdjustmentRule : IEquatable<TimeZoneInfo.AdjustmentRule>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public sealed class TimeZoneInfo.AdjustmentRule : IEquatable<TimeZoneInfo.AdjustmentRule>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type TimeZoneInfo.AdjustmentRule = class
interface IEquatable<TimeZoneInfo.AdjustmentRule>
interface IDeserializationCallback
interface ISerializable
type TimeZoneInfo.AdjustmentRule = class
interface IDeserializationCallback
interface ISerializable
interface IEquatable<TimeZoneInfo.AdjustmentRule>
[<System.Serializable>]
type TimeZoneInfo.AdjustmentRule = class
interface IEquatable<TimeZoneInfo.AdjustmentRule>
interface ISerializable
interface IDeserializationCallback
Public NotInheritable Class TimeZoneInfo.AdjustmentRule
Implements IDeserializationCallback, IEquatable(Of TimeZoneInfo.AdjustmentRule), ISerializable
- 상속
-
TimeZoneInfo.AdjustmentRule
- 특성
- 구현
예제
다음 예제에서는 로컬 시스템에 정의된 모든 표준 시간대를 검색하고 조정 규칙에 대한 전체 정보를 표시합니다.
private enum WeekOfMonth
{
First = 1,
Second = 2,
Third = 3,
Fourth = 4,
Last = 5,
}
private static void ShowStartAndEndDates()
{
// Get all time zones from system
ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();
string[] monthNames = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;
// Get each time zone
foreach (TimeZoneInfo timeZone in timeZones)
{
TimeZoneInfo.AdjustmentRule[] adjustments = timeZone.GetAdjustmentRules();
// Display message for time zones with no adjustments
if (adjustments.Length == 0)
{
Console.WriteLine("{0} has no adjustment rules", timeZone.StandardName);
}
else
{
// Handle time zones with 1 or 2+ adjustments differently
bool showCount = false;
int ctr = 0;
string spacer = "";
Console.WriteLine("{0} Adjustment rules", timeZone.StandardName);
if (adjustments.Length > 1)
{
showCount = true;
spacer = " ";
}
// Iterate adjustment rules
foreach (TimeZoneInfo.AdjustmentRule adjustment in adjustments)
{
if (showCount)
{
Console.WriteLine(" Adjustment rule #{0}", ctr+1);
ctr++;
}
// Display general adjustment information
Console.WriteLine("{0} Start Date: {1:D}", spacer, adjustment.DateStart);
Console.WriteLine("{0} End Date: {1:D}", spacer, adjustment.DateEnd);
Console.WriteLine("{0} Time Change: {1}:{2:00} hours", spacer,
adjustment.DaylightDelta.Hours, adjustment.DaylightDelta.Minutes);
// Get transition start information
TimeZoneInfo.TransitionTime transitionStart = adjustment.DaylightTransitionStart;
Console.Write("{0} Annual Start: ", spacer);
if (transitionStart.IsFixedDateRule)
{
Console.WriteLine("On {0} {1} at {2:t}",
monthNames[transitionStart.Month - 1],
transitionStart.Day,
transitionStart.TimeOfDay);
}
else
{
Console.WriteLine("The {0} {1} of {2} at {3:t}",
((WeekOfMonth)transitionStart.Week).ToString(),
transitionStart.DayOfWeek.ToString(),
monthNames[transitionStart.Month - 1],
transitionStart.TimeOfDay);
}
// Get transition end information
TimeZoneInfo.TransitionTime transitionEnd = adjustment.DaylightTransitionEnd;
Console.Write("{0} Annual End: ", spacer);
if (transitionEnd.IsFixedDateRule)
{
Console.WriteLine("On {0} {1} at {2:t}",
monthNames[transitionEnd.Month - 1],
transitionEnd.Day,
transitionEnd.TimeOfDay);
}
else
{
Console.WriteLine("The {0} {1} of {2} at {3:t}",
((WeekOfMonth)transitionEnd.Week).ToString(),
transitionEnd.DayOfWeek.ToString(),
monthNames[transitionEnd.Month - 1],
transitionEnd.TimeOfDay);
}
}
}
Console.WriteLine();
}
}
type WeekOfMonth =
| First = 1
| Second = 2
| Third = 3
| Fourth = 4
| Last = 5
let showStartAndEndDates () =
// Get all time zones from system
let timeZones = TimeZoneInfo.GetSystemTimeZones()
let monthNames = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames
// Get each time zone
for timeZone in timeZones do
let adjustments = timeZone.GetAdjustmentRules()
// Display message for time zones with no adjustments
if adjustments.Length = 0 then
printfn $"{timeZone.StandardName} has no adjustment rules"
else
// Handle time zones with 1 or 2+ adjustments differently
let mutable ctr = 0
let showCount, spacer =
if adjustments.Length > 1 then
true, " "
else
false, ""
printfn $"{timeZone.StandardName} Adjustment rules"
// Iterate adjustment rules
for adjustment in adjustments do
if showCount then
printfn $" Adjustment rule #{ctr + 1}"
ctr <- ctr + 1
// Display general adjustment information
printfn $"{spacer} Start Date: {adjustment.DateStart:D}"
printfn $"{spacer} End Date: {adjustment.DateEnd:D}"
printfn $"{spacer} Time Change: {adjustment.DaylightDelta.Hours}:{adjustment.DaylightDelta.Minutes:D2} hours"
// Get transition start information
let transitionStart = adjustment.DaylightTransitionStart
printf $"{spacer} Annual Start: "
if transitionStart.IsFixedDateRule then
printfn $"On {monthNames[transitionStart.Month - 1]} {transitionStart.Day} at {transitionStart.TimeOfDay:t}"
else
printfn $"The {transitionStart.Week |> enum<WeekOfMonth>} {transitionStart.DayOfWeek} of {monthNames[transitionStart.Month - 1]} at {transitionStart.TimeOfDay:t}"
// Get transition end information
let transitionEnd = adjustment.DaylightTransitionEnd
printf $"{spacer} Annual End: "
if transitionEnd.IsFixedDateRule then
printfn $"On {monthNames[transitionEnd.Month - 1]} {transitionEnd.Day} at {transitionEnd.TimeOfDay:t}"
else
printfn $"The {enum<WeekOfMonth> transitionEnd.Week} {transitionEnd.DayOfWeek} of {monthNames[transitionEnd.Month - 1]} at {transitionEnd.TimeOfDay:t}"
Console.WriteLine()
Private Enum WeekOfMonth As Integer
First = 1
Second = 2
Third = 3
Fourth = 4
Last = 5
End Enum
Private Sub ShowStartAndEndDates()
' Get all time zones from system
Dim timeZones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()
' Get each time zone
For Each timeZone As TimeZoneInfo In timeZones
Dim adjustments() As TimeZoneInfo.AdjustmentRule = timeZone.GetAdjustmentRules()
' Display message for time zones with no adjustments
If adjustments.Length = 0 Then
Console.WriteLine("{0} has no adjustment rules", timeZone.StandardName)
Else
' Handle time zones with 1 or 2+ adjustments differently
Dim showCount As Boolean = False
Dim ctr As Integer = 0
Dim spacer As String = ""
Console.WriteLine("{0} Adjustment rules", timeZone.StandardName)
If adjustments.Length > 1 Then showCount = True : spacer = " "
' Iterate adjustment rules
For Each adjustment As TimeZoneInfo.AdjustmentRule in adjustments
If showCount Then
Console.WriteLine(" Adjustment rule #{0}", ctr+1)
ctr += 1
End If
' Display general adjustment information
Console.WriteLine("{0} Start Date: {1:D}", spacer, adjustment.DateStart)
Console.WriteLine("{0} End Date: {1:D}", spacer, adjustment.DateEnd)
Console.WriteLine("{0} Time Change: {1}:{2:00} hours", spacer, _
adjustment.DaylightDelta.Hours, adjustment.DaylightDelta.Minutes)
' Get transition start information
Dim transitionStart As TimeZoneInfo.TransitionTime = adjustment.DaylightTransitionStart
Console.Write("{0} Annual Start: ", spacer)
If transitionStart.IsFixedDateRule Then
Console.WriteLine("On {0} {1} at {2:t}", _
MonthName(transitionStart.Month), _
transitionStart.Day, _
transitionStart.TimeOfDay)
Else
Console.WriteLine("The {0} {1} of {2} at {3:t}", _
CType(transitionStart.Week, WeekOfMonth).ToString(), _
transitionStart.DayOfWeek.ToString(), _
MonthName(transitionStart.Month), _
transitionStart.TimeOfDay)
End If
' Get transition end information
Dim transitionEnd As TimeZoneInfo.TransitionTime = adjustment.DaylightTransitionEnd
Console.Write("{0} Annual End: ", spacer)
If transitionEnd.IsFixedDateRule Then
Console.WriteLine("On {0} {1} at {2:t}", _
MonthName(transitionEnd.Month), _
transitionEnd.Day, _
transitionEnd.TimeOfDay)
Else
Console.WriteLine("The {0} {1} of {2} at {3:t}", _
CType(transitionEnd.Week, WeekOfMonth).ToString(), _
transitionEnd.DayOfWeek.ToString(), _
MonthName(transitionEnd.Month), _
transitionEnd.TimeOfDay)
End If
Next
End If
Console.WriteLine()
Next
End Sub
다음은 예제에서 생성되는 출력의 작은 부분입니다. 정확한 출력은 운영 체제 및 예제가 실행되는 날짜에 따라 달라집니다.
Morocco Standard Time Adjustment rules
Adjustment rule #1
Start Date: Tuesday, January 01, 2008
End Date: Wednesday, December 31, 2008
Time Change: 1:00 hours
Annual Start: The Last Saturday of May at 11:59 PM
Annual End: The Last Sunday of August at 11:59 PM
Adjustment rule #2
Start Date: Thursday, January 01, 2009
End Date: Thursday, December 31, 2009
Time Change: 1:00 hours
Annual Start: The Last Sunday of May at 11:59 PM
Annual End: The Third Thursday of August at 11:59 PM
Coordinated Universal Time has no adjustment rules
GMT Standard Time Adjustment rules
Start Date: Monday, January 01, 0001
End Date: Friday, December 31, 9999
Time Change: 1:00 hours
Annual Start: The Last Sunday of March at 1:00 AM
Annual End: The Last Sunday of October at 2:00 AM
Greenwich Standard Time has no adjustment rules
W. Europe Standard Time Adjustment rules
Start Date: Monday, January 01, 0001
End Date: Friday, December 31, 9999
Time Change: 1:00 hours
Annual Start: The Last Sunday of March at 2:00 AM
Annual End: The Last Sunday of October at 3:00 AM
Central Europe Standard Time Adjustment rules
Start Date: Monday, January 01, 0001
End Date: Friday, December 31, 9999
Time Change: 1:00 hours
Annual Start: The Last Sunday of March at 2:00 AM
Annual End: The Last Sunday of October at 3:00 AM
Romance Standard Time Adjustment rules
Start Date: Monday, January 01, 0001
End Date: Friday, December 31, 9999
Time Change: 1:00 hours
Annual Start: The Last Sunday of March at 2:00 AM
Annual End: The Last Sunday of October at 3:00 AM
Central European Standard Time Adjustment rules
Start Date: Monday, January 01, 0001
End Date: Friday, December 31, 9999
Time Change: 1:00 hours
Annual Start: The Last Sunday of March at 2:00 AM
Annual End: The Last Sunday of October at 3:00 AM
W. Central Africa Standard Time has no adjustment rules
설명
클래스는 TimeZoneInfo.AdjustmentRule 일광 절약 시간제에 대한 특정 시간 변경의 유효 시작 및 종료 날짜와 델타(조정으로 인해 표준 시간대의 표준 시간이 변경되는 정확한 양)를 각각 정의합니다. 또한 두 속성은 표준 시간으로의 각 전환이 발생하는 시기를 정의하는 개체를 반환 TimeZoneInfo.TransitionTime 합니다.
참고
클래스의 인스턴스는 TimeZoneInfo.AdjustmentRule 변경할 수 없습니다. 개체를 만든 후에는 해당 값을 수정할 수 없습니다.
개체를 TimeZoneInfo.AdjustmentRule 만들려면 (Shared
Visual Basic의 경우) TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule 메서드를 호출 static
합니다. 그런 다음 메서드의 오버로드 중 TimeZoneInfo.AdjustmentRule 두 개에 개체 배열을 제공할 수 있습니다 TimeZoneInfo.CreateCustomTimeZone . 특정 표준 시간대의 조정 규칙을 검색하려면 개체 배열 TimeZoneInfo.AdjustmentRule 을 반환하는 메서드 TimeZoneInfo.GetAdjustmentRules 를 호출합니다.
속성
BaseUtcOffsetDelta |
조정 규칙 기간 동안 표준 시간대에 대한 기본 UTC 오프셋과의 시간 차이를 가져옵니다. |
DateEnd |
조정 규칙이 더 이상 유효하지 않게 되는 날짜를 가져옵니다. |
DateStart |
조정 규칙이 적용되는 날짜를 가져옵니다. |
DaylightDelta |
표준 시간대의 일광 절약 시간을 구성하는 데 필요한 시간을 가져옵니다. 이 시간은 UTC(협정 세계시)에 대한 해당 표준 시간대의 오프셋에 추가됩니다. |
DaylightTransitionEnd |
일광 절약 시간을 다시 표준 시간으로 전환하는 연간 전환에 대한 정보를 가져옵니다. |
DaylightTransitionStart |
표준 시간에서 일광 절약 시간으로의 연간 전환에 대한 정보를 가져옵니다. |
메서드
CreateAdjustmentRule(DateTime, DateTime, TimeSpan, TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) |
특정 표준 시간대에 대한 새 조정 규칙을 만듭니다. |
CreateAdjustmentRule(DateTime, DateTime, TimeSpan, TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime, TimeSpan) |
특정 표준 시간대에 대한 새 조정 규칙을 만듭니다. |
Equals(Object) |
현재 인스턴스가 다른 인스턴스와 같은지 여부를 나타냅니다. |
Equals(Object) |
지정된 개체가 현재 개체와 같은지 확인합니다. (다음에서 상속됨 Object) |
Equals(TimeZoneInfo+AdjustmentRule) |
현재 TimeZoneInfo.AdjustmentRule 개체가 두 번째 TimeZoneInfo.AdjustmentRule 개체와 같은지 확인합니다. |
GetHashCode() |
해시 테이블과 같은 데이터 구조 및 해싱 알고리즘을 위한 해시 함수 역할을 합니다. |
GetType() |
현재 인스턴스의 Type을 가져옵니다. (다음에서 상속됨 Object) |
MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
IDeserializationCallback.OnDeserialization(Object) |
TimeZoneInfo.AdjustmentRule 개체의 deserialization이 완료될 때 실행됩니다. |
ISerializable.GetObjectData(SerializationInfo, StreamingContext) |
이 개체를 직렬화하는 데 필요한 데이터로 SerializationInfo 개체를 채웁니다. |