-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathTimeZone.xml
697 lines (639 loc) · 46.2 KB
/
TimeZone.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
<Type Name="TimeZone" FullName="System.TimeZone">
<TypeSignature Language="C#" Value="public abstract class TimeZone" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit TimeZone extends System.Object" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="DocId" Value="T:System.TimeZone" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class TimeZone" />
<TypeSignature Language="F#" Value="type TimeZone = class" />
<TypeSignature Language="C++ CLI" Value="public ref class TimeZone abstract" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit TimeZone extends System.Object" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="net-5.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netstandard-2.0;netstandard-2.1">
<AttributeName Language="C#">[System.Obsolete("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")]</AttributeName>
<AttributeName Language="F#">[<System.Obsolete("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-6.0;net-7.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Obsolete("System.TimeZone has been deprecated. Investigate the use of System.TimeZoneInfo instead.")]</AttributeName>
<AttributeName Language="F#">[<System.Obsolete("System.TimeZone has been deprecated. Investigate the use of System.TimeZoneInfo instead.")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Serializable]</AttributeName>
<AttributeName Language="F#">[<System.Serializable>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Runtime.InteropServices.ComVisible(true)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ComVisible(true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a time zone.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A time zone is a geographical region in which the same standard time is used.
> [!IMPORTANT]
> Whenever possible, use the <xref:System.TimeZoneInfo> class instead of the <xref:System.TimeZone> class.
You can use the <xref:System.TimeZone> class to retrieve information about the current time zone, and to convert times from local time to Coordinated Universal Time (UTC) or vice versa. However, you cannot use the <xref:System.TimeZone> class to represent time zones other than the local zone or to handle date and time conversions from one time zone to another. For this purpose, use the <xref:System.TimeZoneInfo> class. You can use this class to retrieve information on any time zone defined on the local system, to create custom time zones, and to convert times from one time zone to another.
The <xref:System.TimeZone> class supports only a single daylight saving time adjustment rule for the local time zone. As a result, the <xref:System.TimeZone> class can accurately report daylight saving time information or convert between UTC and local time only for the period in which the latest adjustment rule is in effect. In contrast, the <xref:System.TimeZoneInfo> class supports multiple adjustment rules, which makes it possible to work with historic time zone data.
## Examples
The following example references and displays selected `TimeZone` class elements.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1":::
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>In addition to providing implementations for its <see langword="abstract" /> members (those marked <see langword="MustOverride" /> in Visual Basic), it is important that classes derived from <see cref="T:System.TimeZone" /> override the default behavior of the <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> method. This is because the default behavior of <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> in the .NET Framework version 2.0 does not depend on a call to <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" />, as it did in the .NET Framework versions 1.0 and 1.1. For details, see the <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> method.</para>
</block>
<altmember cref="T:System.DateTime" />
<altmember cref="T:System.DateTimeOffset" />
<altmember cref="T:System.TimeZoneInfo" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected TimeZone ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:
 TimeZone();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.TimeZone" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CurrentTimeZone">
<MemberSignature Language="C#" Value="public static TimeZone CurrentTimeZone { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.TimeZone CurrentTimeZone" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.CurrentTimeZone" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property CurrentTimeZone As TimeZone" />
<MemberSignature Language="F#" Value="static member CurrentTimeZone : TimeZone" Usage="System.TimeZone.CurrentTimeZone" />
<MemberSignature Language="C++ CLI" Value="public:
 static property TimeZone ^ CurrentTimeZone { TimeZone ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.TimeZone</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the time zone of the current computer.</summary>
<value>A <see cref="T:System.TimeZone" /> object that represents the current local time zone.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZone.CurrentTimeZone%2A> property corresponds to the <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> property.
## Examples
The following example references the `CurrentTimeZone` property and displays the names for standard time and daylight saving time for the local time zone.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1":::
]]></format>
</remarks>
<block subset="none" type="usage">
<para>Local time zone data is cached after <see cref="P:System.TimeZone.CurrentTimeZone" /> is first used to retrieve time zone information. If the system's local time zone subsequently changes, the <see cref="P:System.TimeZone.CurrentTimeZone" /> property does not reflect this change. If you need to handle time zone changes while your application is running, use the <see cref="T:System.TimeZoneInfo" /> class and call its <see cref="M:System.TimeZoneInfo.ClearCachedData" /> method.</para>
</block>
<altmember cref="P:System.TimeZoneInfo.Local" />
</Docs>
</Member>
<Member MemberName="DaylightName">
<MemberSignature Language="C#" Value="public abstract string DaylightName { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DaylightName" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.DaylightName" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property DaylightName As String" />
<MemberSignature Language="F#" Value="member this.DaylightName : string" Usage="System.TimeZone.DaylightName" />
<MemberSignature Language="C++ CLI" Value="public:
 abstract property System::String ^ DaylightName { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the daylight saving time zone name.</summary>
<value>The daylight saving time zone name.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If daylight saving time is not used in the time zone, an empty string ("") is returned.
The <xref:System.TimeZone.DaylightName%2A> property corresponds to the <xref:System.TimeZoneInfo.DaylightName%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.DaylightName%2A?displayProperty=nameWithType> property.
## Examples
The following example references and displays the `DaylightName` property of the current time zone.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="P:System.TimeZoneInfo.DaylightName" />
</Docs>
</Member>
<Member MemberName="GetDaylightChanges">
<MemberSignature Language="C#" Value="public abstract System.Globalization.DaylightTime GetDaylightChanges (int year);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Globalization.DaylightTime GetDaylightChanges(int32 year) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.GetDaylightChanges(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetDaylightChanges (year As Integer) As DaylightTime" />
<MemberSignature Language="F#" Value="abstract member GetDaylightChanges : int -> System.Globalization.DaylightTime" Usage="timeZone.GetDaylightChanges year" />
<MemberSignature Language="C++ CLI" Value="public:
 abstract System::Globalization::DaylightTime ^ GetDaylightChanges(int year);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.DaylightTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="year" Type="System.Int32" />
</Parameters>
<Docs>
<param name="year">The year that the daylight saving time period applies to.</param>
<summary>Returns the daylight saving time period for a particular year.</summary>
<returns>A <see cref="T:System.Globalization.DaylightTime" /> object that contains the start and end date for daylight saving time in <paramref name="year" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Only one daylight saving time period per year is supported.
If daylight saving time is not used in the current time zone, the return value is a <xref:System.Globalization.DaylightTime> object, where the value of <xref:System.Globalization.DaylightTime.Start%2A> and <xref:System.Globalization.DaylightTime.End%2A> is <xref:System.DateTime.MinValue?displayProperty=nameWithType>, and the value of <xref:System.Globalization.DaylightTime.Delta%2A?displayProperty=nameWithType> is a <xref:System.TimeSpan> initialized to 0 ticks.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="year" /> is less than 1 or greater than 9999.</exception>
<block subset="none" type="usage">
<para>Because the <see cref="T:System.TimeZone" /> class supports only one daylight saving time adjustment rule, the <see cref="M:System.TimeZone.GetDaylightChanges(System.Int32)" /> method applies the current adjustment rule to any year, regardless of whether the adjustment rule actually applies to that year. Assuming that the operating system itself has accurate data for a particular year, a more accurate result is available by working with the array of <see cref="T:System.TimeZoneInfo.AdjustmentRule" /> objects returned by the <see cref="M:System.TimeZoneInfo.GetAdjustmentRules" /> method. The <see cref="P:System.Globalization.DaylightTime.Start" />, <see cref="P:System.Globalization.DaylightTime.End" />, and <see cref="P:System.Globalization.DaylightTime.Delta" /> properties correspond to the <see cref="P:System.TimeZoneInfo.AdjustmentRule.DateStart" />, <see cref="P:System.TimeZoneInfo.AdjustmentRule.DateEnd" />, and <see cref="P:System.TimeZoneInfo.AdjustmentRule.DaylightDelta" /> properties.</para>
</block>
<altmember cref="M:System.TimeZoneInfo.GetAdjustmentRules" />
</Docs>
</Member>
<Member MemberName="GetUtcOffset">
<MemberSignature Language="C#" Value="public abstract TimeSpan GetUtcOffset (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.TimeSpan GetUtcOffset(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.GetUtcOffset(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetUtcOffset (time As DateTime) As TimeSpan" />
<MemberSignature Language="F#" Value="abstract member GetUtcOffset : DateTime -> TimeSpan" Usage="timeZone.GetUtcOffset time" />
<MemberSignature Language="C++ CLI" Value="public:
 abstract TimeSpan GetUtcOffset(DateTime time);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.TimeSpan</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time value.</param>
<summary>Returns the Coordinated Universal Time (UTC) offset for the specified local time.</summary>
<returns>The Coordinated Universal Time (UTC) offset from <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method returns the offset, or difference, between the `time` parameter and Coordinated Universal Time (UTC). That is:
`time` = UTC + offset
The method interprets the time zone of `time` based on its <xref:System.DateTime.Kind%2A> property. If the value of the <xref:System.DateTime.Kind%2A> property is <xref:System.DateTimeKind.Local?displayProperty=nameWithType> or <xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>, the method returns the offset of the local time zone. If the value of the <xref:System.DateTime.Kind%2A> property is <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>, the method returns an offset equal to <xref:System.TimeSpan.Zero?displayProperty=nameWithType>.
If the local time zone observes daylight saving time, <xref:System.TimeZone.GetUtcOffset%2A> applies the current adjustment rule to `time` when determining the offset of the local time zone. That is, the offset returned by <xref:System.TimeZone.GetUtcOffset%2A> reflects whether `time` falls in the time zone's standard time or its daylight saving time.
> [!NOTE]
> The <xref:System.TimeZone.GetUtcOffset%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the UTC offset of a local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
The <xref:System.TimeZone.GetUtcOffset%2A> method corresponds to the <xref:System.TimeZoneInfo.GetUtcOffset%2A?displayProperty=nameWithType> method. Whenever possible, use the <xref:System.TimeZoneInfo.GetUtcOffset%2A?displayProperty=nameWithType> method.
Because the date and time value represented by `time` and this value's offset from UTC are not tightly coupled, a local or unspecified date and time value can return a different offset value when run on different computers or when run on the same computer under different time zones. If this behavior is undesirable, use a <xref:System.DateTimeOffset> value instead. The <xref:System.DateTimeOffset> data type tightly couples a date and time value with its offset from UTC.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.GetUtcOffset(System.DateTime)" />
</Docs>
</Member>
<MemberGroup MemberName="IsDaylightSavingTime">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Returns a value indicating whether a specified date and time is within a daylight saving time period.</summary>
</Docs>
</MemberGroup>
<Member MemberName="IsDaylightSavingTime">
<MemberSignature Language="C#" Value="public virtual bool IsDaylightSavingTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsDaylightSavingTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.IsDaylightSavingTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function IsDaylightSavingTime (time As DateTime) As Boolean" />
<MemberSignature Language="F#" Value="abstract member IsDaylightSavingTime : DateTime -> bool
override this.IsDaylightSavingTime : DateTime -> bool" Usage="timeZone.IsDaylightSavingTime time" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual bool IsDaylightSavingTime(DateTime time);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<summary>Returns a value indicating whether the specified date and time is within a daylight saving time period.</summary>
<returns>
<see langword="true" /> if <paramref name="time" /> is in a daylight saving time period; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The year to which the daylight saving time period applies is derived from the `time` parameter.
Because the <xref:System.TimeZone> class supports a single daylight saving time adjustment rule, the <xref:System.TimeZone.IsDaylightSavingTime%28System.DateTime%29> method applies the current adjustment rule to any date, regardless of whether the adjustment rule was in effect on that date. Assuming that the operating system itself has accurate historic daylight saving time data, a more accurate result is available by using the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method. Whenever possible, use the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.IsDaylightSavingTime(System.DateTime)" />
</Docs>
</Member>
<Member MemberName="IsDaylightSavingTime">
<MemberSignature Language="C#" Value="public static bool IsDaylightSavingTime (DateTime time, System.Globalization.DaylightTime daylightTimes);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsDaylightSavingTime(valuetype System.DateTime time, class System.Globalization.DaylightTime daylightTimes) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.IsDaylightSavingTime(System.DateTime,System.Globalization.DaylightTime)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function IsDaylightSavingTime (time As DateTime, daylightTimes As DaylightTime) As Boolean" />
<MemberSignature Language="F#" Value="static member IsDaylightSavingTime : DateTime * System.Globalization.DaylightTime -> bool" Usage="System.TimeZone.IsDaylightSavingTime (time, daylightTimes)" />
<MemberSignature Language="C++ CLI" Value="public:
 static bool IsDaylightSavingTime(DateTime time, System::Globalization::DaylightTime ^ daylightTimes);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
<Parameter Name="daylightTimes" Type="System.Globalization.DaylightTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<param name="daylightTimes">A daylight saving time period.</param>
<summary>Returns a value indicating whether the specified date and time is within the specified daylight saving time period.</summary>
<returns>
<see langword="true" /> if <paramref name="time" /> is in <paramref name="daylightTimes" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method provides the same functionality as this overload of the <xref:System.TimeZone.IsDaylightSavingTime%2A> method. Whenever possible, use the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="daylightTimes" /> is <see langword="null" />.</exception>
<altmember cref="M:System.TimeZoneInfo.IsDaylightSavingTime(System.DateTime)" />
</Docs>
</Member>
<Member MemberName="StandardName">
<MemberSignature Language="C#" Value="public abstract string StandardName { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string StandardName" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.StandardName" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property StandardName As String" />
<MemberSignature Language="F#" Value="member this.StandardName : string" Usage="System.TimeZone.StandardName" />
<MemberSignature Language="C++ CLI" Value="public:
 abstract property System::String ^ StandardName { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the standard time zone name.</summary>
<value>The standard time zone name.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZone.StandardName%2A> property corresponds to the <xref:System.TimeZoneInfo.StandardName%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.StandardName%2A?displayProperty=nameWithType> property.
## Examples
The following example references and displays the `StandardName` property of the current time zone.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/TimeZone/Overview/tzclass.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">An attempt was made to set this property to <see langword="null" />.</exception>
<altmember cref="P:System.TimeZoneInfo.StandardName" />
</Docs>
</Member>
<Member MemberName="ToLocalTime">
<MemberSignature Language="C#" Value="public virtual DateTime ToLocalTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.DateTime ToLocalTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.ToLocalTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ToLocalTime (time As DateTime) As DateTime" />
<MemberSignature Language="F#" Value="abstract member ToLocalTime : DateTime -> DateTime
override this.ToLocalTime : DateTime -> DateTime" Usage="timeZone.ToLocalTime time" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual DateTime ToLocalTime(DateTime time);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A Coordinated Universal Time (UTC) time.</param>
<summary>Returns the local time that corresponds to a specified date and time value.</summary>
<returns>A <see cref="T:System.DateTime" /> object whose value is the local time that corresponds to <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The following table shows the relationship between the `time` parameter and the <xref:System.DateTime> value returned by this method.
|`time` parameter|Behavior|Return value|
|----------------------|--------------|------------------|
|A Coordinated Universal Time (UTC) time (<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>).|Converts the time from UTC to the local time.|A <xref:System.DateTime> object whose value is the local time that corresponds to `time`.|
|A local time (<xref:System.DateTimeKind.Local?displayProperty=nameWithType>).|No conversion necessary.|The same <xref:System.DateTime> value represented by the `time` parameter.|
|An unspecified time (<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>).|Assumes that the time is UTC and converts it from UTC to the local time.|A <xref:System.DateTime> object whose value is the local time that corresponds to `time`.|
If the local time zone observes daylight saving time, <xref:System.TimeZone.ToLocalTime%2A> applies the current adjustment rule to `time` when performing the conversion.
> [!NOTE]
> The <xref:System.TimeZone.ToLocalTime%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the local time corresponding to a particular UTC time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
The <xref:System.TimeZone.ToLocalTime%2A> method corresponds to the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A?displayProperty=nameWithType> method with its `destinationTimeZone` parameter set to <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>. Whenever possible, use the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>Although it is not required, in most cases derived classes running under the .NET Framework version 2.0 should override the default implementation of this method. In the .NET Framework versions 1.0 and 1.1, the <see langword="ToLocalTime" /> method called the <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" /> method and adjusted for daylight saving time when returning the local time. However, starting with the .NET Framework 2.0, the behavior of the default implementation depends on the <see cref="P:System.DateTime.Kind" /> property of the <paramref name="time" /> parameter. If its value is <see cref="F:System.DateTimeKind.Local" />, this method returns <paramref name="time" /> unchanged. If its value is either <see cref="F:System.DateTimeKind.Utc" /> or <see cref="F:System.DateTimeKind.Unspecified" />, this method assumes <paramref name="time" /> is UTC and converts it to the local system time without calling the <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" /> method.
The following code provides a simple override of the default implementation of the <see langword="ToLocalTime" /> method. In this code, the <see langword="internalTimeZone" /> variable represents a private instance of the <see langword="TimeZone" /> class:
:::code language="csharp" source="~/snippets/csharp/System/TimeZone/ToLocalTime/TimeZone_ToLocalTime.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.ToLocalTime/VB/TimeZone_ToLocalTime.vb" id="Snippet1":::</para>
</block>
<altmember cref="M:System.TimeZoneInfo.ConvertTimeFromUtc(System.DateTime,System.TimeZoneInfo)" />
</Docs>
</Member>
<Member MemberName="ToUniversalTime">
<MemberSignature Language="C#" Value="public virtual DateTime ToUniversalTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.DateTime ToUniversalTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.ToUniversalTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ToUniversalTime (time As DateTime) As DateTime" />
<MemberSignature Language="F#" Value="abstract member ToUniversalTime : DateTime -> DateTime
override this.ToUniversalTime : DateTime -> DateTime" Usage="timeZone.ToUniversalTime time" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual DateTime ToUniversalTime(DateTime time);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<summary>Returns the Coordinated Universal Time (UTC) that corresponds to a specified time.</summary>
<returns>A <see cref="T:System.DateTime" /> object whose value is the Coordinated Universal Time (UTC) that corresponds to <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the local time zone observes daylight saving time, <xref:System.TimeZone.ToUniversalTime%2A> applies the current adjustment rule to the `time` parameter when performing the conversion.
> [!NOTE]
> The <xref:System.TimeZone.ToUniversalTime%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the Coordinated Universal Time (UTC) corresponding to a particular local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
If the `time` parameter is an ambiguous time, the method assumes that it is a standard time. (An ambiguous time is one that can map either to a standard time or to a daylight saving time in the local time zone.) If `time` is an invalid time, the method simply subtracts the local time from the local time zone's UTC offset to return UTC. (An invalid time is one that does not exist because of the application of daylight saving time adjustment rules.)
Because `time` is interpreted in relation to the current time zone on the current system, the date and time returned by this method can differ if an application is run on different computers or on the same computer with different time zones. For cases in which a date and time value must represent a single, unambiguous point in time, use a <xref:System.DateTimeOffset> value to represent the local time.
The <xref:System.TimeZone.ToUniversalTime%2A> method corresponds to the <xref:System.TimeZoneInfo.ConvertTimeToUtc%28System.DateTime%29?displayProperty=nameWithType> method overload with a <xref:System.DateTime> parameter whose <xref:System.DateTime.Kind%2A> property does not equal <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>. Whenever possible, use the <xref:System.TimeZoneInfo.ConvertTimeToUtc%28System.DateTime%29?displayProperty=nameWithType> method overload.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.ConvertTimeToUtc(System.DateTime)" />
</Docs>
</Member>
</Members>
</Type>