-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathTimeZoneInfo.xml
3847 lines (3436 loc) · 280 KB
/
TimeZoneInfo.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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="TimeZoneInfo" FullName="System.TimeZoneInfo">
<TypeSignature Language="C#" Value="public sealed class TimeZoneInfo : IEquatable<TimeZoneInfo>" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit TimeZoneInfo extends System.Object implements class System.IEquatable`1<class System.TimeZoneInfo>" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6" />
<TypeSignature Language="DocId" Value="T:System.TimeZoneInfo" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class TimeZoneInfo
Implements IEquatable(Of TimeZoneInfo)" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6" />
<TypeSignature Language="F#" Value="type TimeZoneInfo = class
 interface IEquatable<TimeZoneInfo>" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6" />
<TypeSignature Language="C++ CLI" Value="public ref class TimeZoneInfo sealed : IEquatable<TimeZoneInfo ^>" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netstandard-1.0;netstandard-1.1;netstandard-1.2;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6" />
<TypeSignature Language="C#" Value="public sealed class TimeZoneInfo : IEquatable<TimeZoneInfo>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable" 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;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;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit TimeZoneInfo extends System.Object implements class System.IEquatable`1<class System.TimeZoneInfo>, class System.Runtime.Serialization.IDeserializationCallback, class System.Runtime.Serialization.ISerializable" 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="VB.NET" Value="Public NotInheritable Class TimeZoneInfo
Implements IDeserializationCallback, IEquatable(Of TimeZoneInfo), ISerializable" 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;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;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="F#" Value="type TimeZoneInfo = class
 interface IEquatable<TimeZoneInfo>
 interface IDeserializationCallback
 interface ISerializable" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.1;netcore-2.2;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="C++ CLI" Value="public ref class TimeZoneInfo sealed : IEquatable<TimeZoneInfo ^>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable" 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;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;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="F#" Value="type TimeZoneInfo = class
 interface IEquatable<TimeZoneInfo>
 interface ISerializable
 interface IDeserializationCallback" FrameworkAlternate="netcore-2.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" />
<TypeSignature Language="F#" Value="type TimeZoneInfo = class
 interface IDeserializationCallback
 interface ISerializable
 interface IEquatable<TimeZoneInfo>" FrameworkAlternate="netcore-3.0;netcore-3.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable sealed beforefieldinit TimeZoneInfo extends System.Object implements class System.IEquatable`1<class System.TimeZoneInfo>, class System.Runtime.Serialization.IDeserializationCallback, class System.Runtime.Serialization.ISerializable" FrameworkAlternate="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>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<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>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="mscorlib" FromVersion="4.0.0.0" To="System.Runtime" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
<TypeForwarding From="System.Core" FromVersion="4.0.0.0" To="System.Runtime" ToVersion="0.0.0.0" FrameworkAlternate="dotnet-uwp-10.0" />
<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" />
<TypeForwarding From="System.Core" FromVersion="4.0.0.0" To="mscorlib" ToVersion="4.0.0.0" FrameworkAlternate="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" />
<TypeForwarding From="System.Runtime" FromVersion="4.1.1.1" To="mscorlib" ToVersion="4.0.0.0" FrameworkAlternate="netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.IEquatable<System.TimeZoneInfo></InterfaceName>
</Interface>
<Interface 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;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;netstandard-2.0;netstandard-2.1">
<InterfaceName>System.Runtime.Serialization.IDeserializationCallback</InterfaceName>
</Interface>
<Interface 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;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;netstandard-2.0;netstandard-2.1">
<InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<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-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-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.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents any time zone in the world.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A time zone is a geographical region in which the same time is used.
The <xref:System.TimeZoneInfo> class offers significant enhancements over the <xref:System.TimeZone> class, which provides only limited functionality.
The <xref:System.TimeZone> class recognizes only the local time zone, and can convert times between Coordinated Universal Time (UTC) and local time. A <xref:System.TimeZoneInfo> object can represent any time zone, and methods of the <xref:System.TimeZoneInfo> class can be used to convert the time in one time zone to the corresponding time in any other time zone. The members of the <xref:System.TimeZoneInfo> class support the following operations:
- Retrieving a time zone that is already defined by the operating system.
- Enumerating the time zones that are available on a system.
- Converting times between different time zones.
- Creating a new time zone that is not already defined by the operating system.
- Serializing a time zone for later retrieval.
> [!NOTE]
> An instance of the <xref:System.TimeZoneInfo> class is immutable. Once an object has been instantiated, its values cannot be modified.
You cannot instantiate a <xref:System.TimeZoneInfo> object using the `new` keyword. Instead, you must call one of the static members of the <xref:System.TimeZoneInfo> class shown in the following table.
|Static member name|Description|
|------------------------|-----------------|
|<xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method|Creates a custom time zone from application-supplied data.|
|<xref:System.TimeZoneInfo.FindSystemTimeZoneById%2A> method|Instantiates a time zone based on its identifier.|
|<xref:System.TimeZoneInfo.FromSerializedString%2A> method|Deserializes a string value to re-create a previously serialized <xref:System.TimeZoneInfo> object.|
|<xref:System.TimeZoneInfo.GetSystemTimeZones%2A> method|Returns an enumerable <xref:System.Collections.ObjectModel.ReadOnlyCollection%601> of <xref:System.TimeZoneInfo> objects that represents all time zones that are available on the local system.|
|<xref:System.TimeZoneInfo.Local%2A> property|Instantiates a <xref:System.TimeZoneInfo> object that represents the local time zone.|
|<xref:System.TimeZoneInfo.Utc%2A> property|Instantiates a <xref:System.TimeZoneInfo> object that represents the UTC zone.|
You can use the <xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method to create a time zone that is not defined in the local system registry on Windows systems or by the [ICU Library's Time Zone Data](https://unicode-org.github.io/icu/userguide/datetime/timezone/) on Linux or macOS. You can then use the <xref:System.TimeZoneInfo.ToSerializedString%2A> property to save the time zone object's information as a string, which can be stored in some form that is accessible to the application. You can use the <xref:System.TimeZoneInfo.FromSerializedString%2A> method to convert a serialized string back to a <xref:System.TimeZoneInfo> object.
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName="BaseUtcOffset">
<MemberSignature Language="C#" Value="public TimeSpan BaseUtcOffset { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.TimeSpan BaseUtcOffset" />
<MemberSignature Language="DocId" Value="P:System.TimeZoneInfo.BaseUtcOffset" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property BaseUtcOffset As TimeSpan" />
<MemberSignature Language="F#" Value="member this.BaseUtcOffset : TimeSpan" Usage="System.TimeZoneInfo.BaseUtcOffset" />
<MemberSignature Language="C++ CLI" Value="public:
 property TimeSpan BaseUtcOffset { TimeSpan get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<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>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.TimeSpan</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).</summary>
<value>An object that indicates the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The time span returned by the <xref:System.TimeZoneInfo.BaseUtcOffset%2A> property can range from 14 hours (for a time zone that is 14 hours ahead of Coordinated Universal Time (UTC)) to -14 hours (for a time zone that is 14 hours behind UTC). Time zones that are ahead of UTC have a positive offset; time zones that are behind UTC have a negative offset.
The <xref:System.TimeZoneInfo.BaseUtcOffset%2A> value is represented as a whole number of minutes. It cannot include a fractional number of minutes.
> [!NOTE]
> Because <xref:System.TimeZoneInfo.BaseUtcOffset%2A> is a property of the <xref:System.TimeZoneInfo> object rather than the <xref:System.TimeZoneInfo.AdjustmentRule> object, the <xref:System.TimeZoneInfo> class applies a single offset from UTC to all of a time zone's adjustments. To reflect a time zone that has modified its offset from UTC, you must create a new time zone using the <xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method.
The <xref:System.TimeZoneInfo.BaseUtcOffset%2A> property differs from the <xref:System.TimeZoneInfo.GetUtcOffset%2A> method in the following ways:
- The <xref:System.TimeZoneInfo.BaseUtcOffset%2A> property returns the difference between UTC and the time zone's standard time; the <xref:System.TimeZoneInfo.GetUtcOffset%2A> method returns the difference between UTC and the time zone's time at a particular point in time.
- The <xref:System.TimeZoneInfo.GetUtcOffset%2A> method reflects the application of any adjustment rules to the time zone; the <xref:System.TimeZoneInfo.BaseUtcOffset%2A> property does not.
## Examples
The following example uses the <xref:System.TimeZoneInfo.BaseUtcOffset%2A> property to display the difference between the local time and Coordinated Universal Time (UTC).
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/BaseUtcOffset/TimeZone2_Examples.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.Class/VB/TimeZone2_Examples.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="Overload:System.TimeZoneInfo.GetUtcOffset" />
</Docs>
</Member>
<Member MemberName="ClearCachedData">
<MemberSignature Language="C#" Value="public static void ClearCachedData ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ClearCachedData() cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ClearCachedData" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub ClearCachedData ()" />
<MemberSignature Language="F#" Value="static member ClearCachedData : unit -> unit" Usage="System.TimeZoneInfo.ClearCachedData " />
<MemberSignature Language="C++ CLI" Value="public:
 static void ClearCachedData();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Clears cached time zone data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Cached time zone data includes data on the local time zone and the Coordinated Universal Time (UTC) zone.
You might call the `ClearCachedData` method to reduce the memory devoted to the application's cache of time zone information or to reflect the fact that the local system's time zone has changed.
Storing references to the local and UTC time zones is not recommended. After the call to the `ClearCachedData` method, these object variables will be undefined <xref:System.TimeZoneInfo> objects that are no longer references to <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> or <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>. For example, in the following code, the second call to the <xref:System.TimeZoneInfo.ConvertTime%28System.DateTime%2CSystem.TimeZoneInfo%2CSystem.TimeZoneInfo%29?displayProperty=nameWithType> method throws an <xref:System.ArgumentException> because the `local` variable is no longer considered equal to <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ClearCachedData/System.TimeZone2.BestPractices.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ClearCachedData/System.TimeZone2.BestPractices.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.BestPractices/vb/System.TimeZone2.BestPractices.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
<MemberGroup MemberName="ConvertTime">
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Converts a time to the time in a particular time zone.</summary>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</MemberGroup>
<Member MemberName="ConvertTime">
<MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTime(valuetype System.DateTime dateTime, class System.TimeZoneInfo destinationTimeZone) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTime(System.DateTime,System.TimeZoneInfo)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTime (dateTime As DateTime, destinationTimeZone As TimeZoneInfo) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTime : DateTime * TimeZoneInfo -> DateTime" Usage="System.TimeZoneInfo.ConvertTime (dateTime, destinationTimeZone)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo ^ destinationTimeZone);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<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>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" />
<Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
</Parameters>
<Docs>
<param name="dateTime">The date and time to convert.</param>
<param name="destinationTimeZone">The time zone to convert <paramref name="dateTime" /> to.</param>
<summary>Converts a time to the time in a particular time zone.</summary>
<returns>The date and time in the destination time zone.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When performing the conversion, the <xref:System.TimeZoneInfo.ConvertTime%28System.DateTimeOffset%2CSystem.TimeZoneInfo%29> method applies any adjustment rules in effect in the `destinationTimeZone` time zone.
This overload of the <xref:System.TimeZoneInfo.ConvertTime%28System.DateTime%2CSystem.TimeZoneInfo%29> method determines the source time zone from the value of the `dateTime` parameter's <xref:System.DateTime.Kind%2A> property, as the following table shows.
|Kind property value|Source time zone|Method behavior|
|-------------------------|----------------------|---------------------|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|<xref:System.TimeZoneInfo.Local%2A>|Converts the local time to the time in `destinationTimeZone`.|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|<xref:System.TimeZoneInfo.Utc%2A>|Converts Coordinated Universal Time (UTC) to the time in `destinationTimeZone`.|
|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|Assumed to be <xref:System.TimeZoneInfo.Local%2A>.|Converts the local time to the time in `destinationTimeZone`.|
The <xref:System.DateTime.Kind%2A> property of the returned <xref:System.DateTime> value is set as shown in the following table.
|Condition|Returned Kind property value|
|---------------|----------------------------------|
|The `destinationTimeZone` is <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>.|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|
|The `destinationTimeZone` is <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>.|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|
|All other date and time values and destination time zones.|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|
If the value of the `dateTime` parameter is an ambiguous local time, it is interpreted as a standard time. If the `dateTime` parameter is an invalid local time, this method throws an <xref:System.ArgumentException>.
If the conversion of `dateTime` results in a date and time value that is earlier than <xref:System.DateTime.MinValue?displayProperty=nameWithType> or later than <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTime.MinValue?displayProperty=nameWithType> or <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, respectively.
You can also convert to or from UTC by calling the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A> and <xref:System.TimeZoneInfo.ConvertTimeToUtc%2A> methods.
## Examples
The following example converts an array of date and time values to times in the Eastern Time zone of the U.S. and Canada. It shows that the source time zone depends on the <xref:System.DateTime.Kind%2A?displayProperty=nameWithType> property of the source <xref:System.DateTime> value. It also illustrates that the <xref:System.TimeZoneInfo.ConvertTime%2A> method takes time zone adjustments into account, because a time zone adjustment occurs in both the source and destination time zones at 2:00 A.M. on November 7, 2010.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTime/converttime1.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTime/converttime1.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.timezoneinfo.converttime/vb/converttime1.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The value of the <paramref name="dateTime" /> parameter represents an invalid time.</exception>
<exception cref="T:System.ArgumentNullException">The value of the <paramref name="destinationTimeZone" /> parameter is <see langword="null" />.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTime">
<MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTime (DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTimeOffset ConvertTime(valuetype System.DateTimeOffset dateTimeOffset, class System.TimeZoneInfo destinationTimeZone) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTime(System.DateTimeOffset,System.TimeZoneInfo)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTime (dateTimeOffset As DateTimeOffset, destinationTimeZone As TimeZoneInfo) As DateTimeOffset" />
<MemberSignature Language="F#" Value="static member ConvertTime : DateTimeOffset * TimeZoneInfo -> DateTimeOffset" Usage="System.TimeZoneInfo.ConvertTime (dateTimeOffset, destinationTimeZone)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo ^ destinationTimeZone);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<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>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTimeOffset</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" />
<Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" />
</Parameters>
<Docs>
<param name="dateTimeOffset">The date and time to convert.</param>
<param name="destinationTimeZone">The time zone to convert <paramref name="dateTimeOffset" /> to.</param>
<summary>Converts a time to the time in a particular time zone.</summary>
<returns>The date and time in the destination time zone.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When performing the conversion, the <xref:System.TimeZoneInfo.ConvertTime%28System.DateTimeOffset%2CSystem.TimeZoneInfo%29> method applies any adjustment rules in effect in the `destinationTimeZone` time zone.
This overload differs from the other overloads of the <xref:System.TimeZoneInfo.ConvertTime%2A> method by accepting a <xref:System.DateTimeOffset> value as its first parameter. This identifies the date and time as an offset from Coordinated Universal Time (UTC) rather than as the date and time in a particular time zone. As a result, the `dateTimeOffset` parameter cannot represent either an ambiguous time or an invalid time.
In converting the `dateTimeOffset` value to the time in the destination time zone, this method takes into account any adjustment rules in effect in the destination time zone.
If the conversion of `dateTimeOffset` results in a date and time value that is earlier than <xref:System.DateTimeOffset.MinValue?displayProperty=nameWithType> or later than <xref:System.DateTimeOffset.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTimeOffset.MinValue?displayProperty=nameWithType> or <xref:System.DateTimeOffset.MaxValue?displayProperty=nameWithType>, respectively.
## Examples
The following example converts an array of <xref:System.DateTimeOffset> values to times in the Eastern Time zone of the U.S. and Canada. It illustrates that the <xref:System.TimeZoneInfo.ConvertTime%2A> method takes time zone adjustments into account, because a time zone adjustment occurs in both the source and destination time zones at 2:00 A.M. on November 7, 2010.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTime/converttime2.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTime/converttime2.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.timezoneinfo.converttime/vb/converttime2.vb" id="Snippet2":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The value of the <paramref name="destinationTimeZone" /> parameter is <see langword="null" />.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTime">
<MemberSignature Language="C#" Value="public static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTime(valuetype System.DateTime dateTime, class System.TimeZoneInfo sourceTimeZone, class System.TimeZoneInfo destinationTimeZone) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTime(System.DateTime,System.TimeZoneInfo,System.TimeZoneInfo)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTime (dateTime As DateTime, sourceTimeZone As TimeZoneInfo, destinationTimeZone As TimeZoneInfo) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTime : DateTime * TimeZoneInfo * TimeZoneInfo -> DateTime" Usage="System.TimeZoneInfo.ConvertTime (dateTime, sourceTimeZone, destinationTimeZone)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo ^ sourceTimeZone, TimeZoneInfo ^ destinationTimeZone);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<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>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" Index="0" FrameworkAlternate="dotnet-uwp-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;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;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<Parameter Name="sourceTimeZone" Type="System.TimeZoneInfo" Index="1" FrameworkAlternate="dotnet-uwp-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;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;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
<Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" Index="2" FrameworkAlternate="dotnet-uwp-10.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;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;netstandard-1.3;netstandard-1.4;netstandard-1.5;netstandard-1.6;netstandard-2.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="dateTime">The date and time to convert.</param>
<param name="sourceTimeZone">The time zone of <paramref name="dateTime" />.</param>
<param name="destinationTimeZone">The time zone to convert <paramref name="dateTime" /> to.</param>
<summary>Converts a time from one time zone to another.</summary>
<returns>The date and time in the destination time zone that corresponds to the <paramref name="dateTime" /> parameter in the source time zone.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When performing the conversion, the <xref:System.TimeZoneInfo.ConvertTime%2A> method applies any adjustment rules in effect in the `destinationTimeZone` time zone.
The value of the <xref:System.DateTime.Kind%2A> property of the `dateTime` parameter must correspond to the `sourceTimeZone` parameter, as the following table shows.
|DateTime.Kind value|sourceTimeZone value|Method behavior|
|-------------------------|--------------------------|---------------------|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Equals <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>.|Converts `dateTime` to the destination time zone's time.|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Does not equal <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>.|Throws an <xref:System.ArgumentException>.|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Equals <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>.|Converts `dateTime` to the destination time zone's time.|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Does not equal <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>.|Throws an <xref:System.ArgumentException>.|
|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|Any.|Converts `dateTime` to the destination time zone's time.|
You can also convert to or from Coordinated Universal Time (UTC) by calling the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A> and <xref:System.TimeZoneInfo.ConvertTimeToUtc%2A> methods.
The <xref:System.DateTime.Kind%2A> property of the returned <xref:System.DateTime> value is set as shown in the following table.
|Condition|Returned Kind property value|
|---------------|----------------------------------|
|The `destinationTimeZone` argument is <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>.|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|
|The `destinationTimeZone` argument is <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>.|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|
|All other date and time values, source time zones, and destination time zones.|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|
If the value of the `dateTime` parameter is an ambiguous time in the source time zone, it is interpreted as a standard time. If the `dateTime` parameter is an invalid time in the source time zone, this method throws an <xref:System.ArgumentException>.
If the conversion of `dateTime` results in a date and time value that is earlier than <xref:System.DateTime.MinValue?displayProperty=nameWithType> or later than <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTime.MinValue?displayProperty=nameWithType> or <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, respectively.
The <xref:System.TimeZoneInfo.ConvertTime%28System.DateTime%2CSystem.TimeZoneInfo%2CSystem.TimeZoneInfo%29> method throws an <xref:System.ArgumentException> exception if the <xref:System.DateTime.Kind%2A?displayProperty=nameWithType> property of the `dateTime` argument is <xref:System.DateTimeKind.Local?displayProperty=nameWithType> but the `sourceTimeZone` argument is not <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>. To determine whether the source time zone is the local time zone or the universal time zone, the method tests for reference equality instead of testing for value equality with the <xref:System.TimeZoneInfo.Equals%28System.TimeZoneInfo%29> method. Note that <xref:System.TimeZoneInfo> objects that represent the local time zone and that are retrieved by calling the <xref:System.TimeZoneInfo.FindSystemTimeZoneById%2A> method do not have referential equality with <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>. Furthermore, <xref:System.TimeZoneInfo> objects that represent the local or universal time zone and that are retrieved by iterating the collection returned by the <xref:System.TimeZoneInfo.GetSystemTimeZones%2A> method do not have referential equality with <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> or <xref:System.TimeZoneInfo.Utc%2A?displayProperty=nameWithType>. As an alternative, you can call the <xref:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId%28System.DateTime%2CSystem.String%2CSystem.String%29> method.
## Examples
The following example illustrates the use of the <xref:System.TimeZoneInfo.ConvertTime%28System.DateTime%2CSystem.TimeZoneInfo%2CSystem.TimeZoneInfo%29> method to convert from Hawaiian Standard Time to local time.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs" id="Snippet9":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.fs" id="Snippet9":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.Concepts/VB/TimeZone2Concepts.vb" id="Snippet9":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.DateTime.Kind" /> property of the <paramref name="dateTime" /> parameter is <see cref="F:System.DateTimeKind.Local" />, but the <paramref name="sourceTimeZone" /> parameter does not equal <see cref="F:System.DateTimeKind.Local" />.
-or-
The <see cref="P:System.DateTime.Kind" /> property of the <paramref name="dateTime" /> parameter is <see cref="F:System.DateTimeKind.Utc" />, but the <paramref name="sourceTimeZone" /> parameter does not equal <see cref="P:System.TimeZoneInfo.Utc" />.
-or-
The <paramref name="dateTime" /> parameter is an invalid time (that is, it represents a time that does not exist because of a time zone's adjustment rules).</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="sourceTimeZone" /> parameter is <see langword="null" />.
-or-
The <paramref name="destinationTimeZone" /> parameter is <see langword="null" />.</exception>
<altmember cref="Overload:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId" />
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<MemberGroup MemberName="ConvertTimeBySystemTimeZoneId">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Converts a time to the time in another time zone based on a time zone identifier.</summary>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</MemberGroup>
<Member MemberName="ConvertTimeBySystemTimeZoneId">
<MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string destinationTimeZoneId);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTimeBySystemTimeZoneId(valuetype System.DateTime dateTime, string destinationTimeZoneId) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId(System.DateTime,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeBySystemTimeZoneId (dateTime As DateTime, destinationTimeZoneId As String) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTimeBySystemTimeZoneId : DateTime * string -> DateTime" Usage="System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId (dateTime, destinationTimeZoneId)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, System::String ^ destinationTimeZoneId);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
<Parameter Name="destinationTimeZoneId" Type="System.String" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
</Parameters>
<Docs>
<param name="dateTime">The date and time to convert.</param>
<param name="destinationTimeZoneId">The identifier of the destination time zone.</param>
<summary>Converts a time to the time in another time zone based on the time zone's identifier.</summary>
<returns>The date and time in the destination time zone.</returns>
<remarks>
<format type="text/markdown">< on Linux and macOS. It cannot retrieve a time zone object that is created using the <xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method. The `destinationTimeZoneId` parameter must correspond exactly to the time zone's identifier in length, but not in case, for a successful match to occur; that is, the comparison of `destinationTimeZoneId` with time zone identifiers is case-insensitive.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="destinationTimeZoneId" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidTimeZoneException">The time zone identifier was found, but the registry data is corrupted.</exception>
<exception cref="T:System.Security.SecurityException">The process does not have the permissions required to read from the registry key that contains the time zone information.</exception>
<exception cref="T:System.TimeZoneNotFoundException">The <paramref name="destinationTimeZoneId" /> identifier was not found on the local system.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTimeBySystemTimeZoneId">
<MemberSignature Language="C#" Value="public static DateTimeOffset ConvertTimeBySystemTimeZoneId (DateTimeOffset dateTimeOffset, string destinationTimeZoneId);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTimeOffset ConvertTimeBySystemTimeZoneId(valuetype System.DateTimeOffset dateTimeOffset, string destinationTimeZoneId) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId(System.DateTimeOffset,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeBySystemTimeZoneId (dateTimeOffset As DateTimeOffset, destinationTimeZoneId As String) As DateTimeOffset" />
<MemberSignature Language="F#" Value="static member ConvertTimeBySystemTimeZoneId : DateTimeOffset * string -> DateTimeOffset" Usage="System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId (dateTimeOffset, destinationTimeZoneId)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTimeOffset ConvertTimeBySystemTimeZoneId(DateTimeOffset dateTimeOffset, System::String ^ destinationTimeZoneId);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTimeOffset</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTimeOffset" Type="System.DateTimeOffset" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
<Parameter Name="destinationTimeZoneId" Type="System.String" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
</Parameters>
<Docs>
<param name="dateTimeOffset">The date and time to convert.</param>
<param name="destinationTimeZoneId">The identifier of the destination time zone.</param>
<summary>Converts a time to the time in another time zone based on the time zone's identifier.</summary>
<returns>The date and time in the destination time zone.</returns>
<remarks>
<format type="text/markdown">< on Linux and macOS. It cannot retrieve a time zone object that is created using the <xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method. The `destinationTimeZoneId` parameter must correspond exactly to the time zone's identifier in length, but not in case, for a successful match to occur; that is, the comparison of `destinationTimeZoneId` with time zone identifiers is case-insensitive.
In converting the `dateTimeOffset` value to the time in the destination time zone, the method takes into account any adjustment rules in effect in the destination time zone.
If the conversion of `dateTimeOffset` results in a date and time value that is earlier than <xref:System.DateTimeOffset.MinValue?displayProperty=nameWithType> or later than <xref:System.DateTimeOffset.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTimeOffset.MinValue?displayProperty=nameWithType> or <xref:System.DateTimeOffset.MaxValue?displayProperty=nameWithType>, respectively.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="destinationTimeZoneId" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidTimeZoneException">The time zone identifier was found but the registry data is corrupted.</exception>
<exception cref="T:System.Security.SecurityException">The process does not have the permissions required to read from the registry key that contains the time zone information.</exception>
<exception cref="T:System.TimeZoneNotFoundException">The <paramref name="destinationTimeZoneId" /> identifier was not found on the local system.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTimeBySystemTimeZoneId">
<MemberSignature Language="C#" Value="public static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTimeBySystemTimeZoneId(valuetype System.DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId(System.DateTime,System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeBySystemTimeZoneId (dateTime As DateTime, sourceTimeZoneId As String, destinationTimeZoneId As String) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTimeBySystemTimeZoneId : DateTime * string * string -> DateTime" Usage="System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId (dateTime, sourceTimeZoneId, destinationTimeZoneId)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTimeBySystemTimeZoneId(DateTime dateTime, System::String ^ sourceTimeZoneId, System::String ^ destinationTimeZoneId);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
<Parameter Name="sourceTimeZoneId" Type="System.String" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
<Parameter Name="destinationTimeZoneId" Type="System.String" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
</Parameters>
<Docs>
<param name="dateTime">The date and time to convert.</param>
<param name="sourceTimeZoneId">The identifier of the source time zone.</param>
<param name="destinationTimeZoneId">The identifier of the destination time zone.</param>
<summary>Converts a time from one time zone to another based on time zone identifiers.</summary>
<returns>The date and time in the destination time zone that corresponds to the <paramref name="dateTime" /> parameter in the source time zone.</returns>
<remarks>
<format type="text/markdown">< on Linux and macOS. It cannot retrieve time zone objects that are created using the <xref:System.TimeZoneInfo.CreateCustomTimeZone%2A> method.
The value of the <xref:System.DateTime.Kind%2A> property of the `dateTime` parameter must correspond to the `sourceTimeZoneId` parameter, as the following table shows.
|DateTime.Kind value|sourceTimeZone value|Method behavior|
|-------------------------|--------------------------|---------------------|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Equals `TimeZoneInfo.Utc.Id`.|Converts `dateTime` to the destination time zone's time.|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Does not equal `TimeZoneInfo.Utc.Id`.|Throws an <xref:System.ArgumentException>.|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Equals `TimeZoneInfo.Local.Id`.|Converts `dateTime` to the destination time zone's time.|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Does not equal `TimeZoneInfo.Local.Id`.|Throws an <xref:System.ArgumentException>.|
|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|Any.|Converts `dateTime` to the destination time zone's time.|
Because it relies on calls to the <xref:System.TimeZoneInfo.FindSystemTimeZoneById%2A> method, the <xref:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId%2A> method performs a case-insensitive search to locate the time zones that correspond to `sourceTimeZoneId` and `destinationTimeZoneId`.
If the value of the `dateTime` parameter is an ambiguous time in the source time zone, it is interpreted as a standard time. If the `dateTime` parameter is an invalid time in the source time zone, this method throws an <xref:System.ArgumentException>.
The <xref:System.DateTime.Kind%2A> property of the returned <xref:System.DateTime> value is set to <xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType> unless the destination time zone is Coordinated Universal Time (UTC), in which case it is set to <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>.
## Examples
The following example uses the <xref:System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId%28System.DateTime%2CSystem.String%2CSystem.String%29?displayProperty=nameWithType> method to display the time that corresponds to the local system time in eight cities of the world.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTimeBySystemTimeZoneId/System.TimeZone2.Conversions.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTimeBySystemTimeZoneId/System.TimeZone2.Conversions.fs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.Conversions/vb/System.TimeZone2.Conversions.vb" id="Snippet3":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.DateTime.Kind" /> property of the <paramref name="dateTime" /> parameter does not correspond to the source time zone.
-or-
<paramref name="dateTime" /> is an invalid time in the source time zone.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="sourceTimeZoneId" /> is <see langword="null" />.
-or-
<paramref name="destinationTimeZoneId" /> is <see langword="null" />.</exception>
<exception cref="T:System.InvalidTimeZoneException">The time zone identifiers were found, but the registry data is corrupted.</exception>
<exception cref="T:System.Security.SecurityException">The user does not have the permissions required to read from the registry keys that hold time zone data.</exception>
<exception cref="T:System.TimeZoneNotFoundException">The <paramref name="sourceTimeZoneId" /> identifier was not found on the local system.
-or-
The <paramref name="destinationTimeZoneId" /> identifier was not found on the local system.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTimeFromUtc">
<MemberSignature Language="C#" Value="public static DateTime ConvertTimeFromUtc (DateTime dateTime, TimeZoneInfo destinationTimeZone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTimeFromUtc(valuetype System.DateTime dateTime, class System.TimeZoneInfo destinationTimeZone) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeFromUtc(System.DateTime,System.TimeZoneInfo)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeFromUtc (dateTime As DateTime, destinationTimeZone As TimeZoneInfo) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTimeFromUtc : DateTime * TimeZoneInfo -> DateTime" Usage="System.TimeZoneInfo.ConvertTimeFromUtc (dateTime, destinationTimeZone)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo ^ destinationTimeZone);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
<Parameter Name="destinationTimeZone" Type="System.TimeZoneInfo" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
</Parameters>
<Docs>
<param name="dateTime">The Coordinated Universal Time (UTC).</param>
<param name="destinationTimeZone">The time zone to convert <paramref name="dateTime" /> to.</param>
<summary>Converts a Coordinated Universal Time (UTC) to the time in a specified time zone.</summary>
<returns>The date and time in the destination time zone. Its <see cref="P:System.DateTime.Kind" /> property is <see cref="F:System.DateTimeKind.Utc" /> if <paramref name="destinationTimeZone" /> is <see cref="P:System.TimeZoneInfo.Utc" />; otherwise, its <see cref="P:System.DateTime.Kind" /> property is <see cref="F:System.DateTimeKind.Unspecified" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When performing the conversion, the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A> method applies any adjustment rules in effect in the `destinationTimeZone` time zone.
The precise behavior of this method depends on the value of the <xref:System.DateTime.Kind%2A> property of the `dateTime` parameter, as the following table shows.
|DateTime.Kind property|Conversion|
|----------------------------|----------------|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Throws an <xref:System.ArgumentException>.|
|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType> or <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Converts from Coordinated Universal Time (UTC).|
If the conversion of `dateTime` results in a date and time value that is earlier than <xref:System.DateTime.MinValue?displayProperty=nameWithType> or later than <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTime.MinValue?displayProperty=nameWithType> or <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, respectively.
## Examples
The following example converts Coordinated Universal Time (UTC) to Central Time.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.cs" id="Snippet8":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTime/TimeZone2Concepts.fs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.Concepts/VB/TimeZone2Concepts.vb" id="Snippet8":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.DateTime.Kind" /> property of <paramref name="dateTime" /> is <see cref="F:System.DateTimeKind.Local" />.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="destinationTimeZone" /> is <see langword="null" />.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<MemberGroup MemberName="ConvertTimeToUtc">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Converts a date and time to Coordinated Universal Time (UTC).</summary>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</MemberGroup>
<Member MemberName="ConvertTimeToUtc">
<MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTimeToUtc(valuetype System.DateTime dateTime) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeToUtc(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeToUtc (dateTime As DateTime) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTimeToUtc : DateTime -> DateTime" Usage="System.TimeZoneInfo.ConvertTimeToUtc dateTime" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTimeToUtc(DateTime dateTime);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<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>
<AssemblyInfo>
<AssemblyName>System.Core</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dateTime" Type="System.DateTime" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-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;netstandard-2.0;netstandard-2.1;netcore-3.1;net-5.0;net-6.0;net-7.0;netframework-4.8.1;net-8.0;net-9.0" />
</Parameters>
<Docs>
<param name="dateTime">The date and time to convert.</param>
<summary>Converts the specified date and time to Coordinated Universal Time (UTC).</summary>
<returns>The Coordinated Universal Time (UTC) that corresponds to the <paramref name="dateTime" /> parameter. The <see cref="T:System.DateTime" /> value's <see cref="P:System.DateTime.Kind" /> property is always set to <see cref="F:System.DateTimeKind.Utc" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The exact conversion performed depends on the value of the <xref:System.DateTime.Kind%2A> property of the `dateTime` parameter, as the following table shows.
|DateTime.Kind property|Conversion|
|----------------------------|----------------|
|<xref:System.DateTimeKind.Local?displayProperty=nameWithType>|Converts from local time to Coordinated Universal Time (UTC).|
|<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>|Assumes `dateTime` is local time and converts from local time to UTC.|
|<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>|Returns `dateTime` unchanged.|
If `dateTime` corresponds to an ambiguous local time, this method assumes that it is standard local time. If `dateTime` corresponds to an invalid local time, the method throws an <xref:System.ArgumentException>.
> [!NOTE]
> If the current computer's local time zone includes multiple adjustment rules, this overload of the <xref:System.TimeZoneInfo.ConvertTimeToUtc%2A> method can return results that differ from the <xref:System.TimeZone.ToUniversalTime%2A?displayProperty=nameWithType> and <xref:System.DateTime.ToUniversalTime%2A?displayProperty=nameWithType> methods. <xref:System.TimeZone.ToUniversalTime%2A?displayProperty=nameWithType> always applies the current adjustment rule to time zone conversion, whether or not `dateTime` lies within its date range. And when executing on .NET Framework 3.5, <xref:System.DateTime.ToUniversalTime%2A?displayProperty=nameWithType> also applies the current adjustment rule to time zone conversion, whether or not `dateTime` lies within its date range.
If the UTC equivalent of `dateTime` is earlier than <xref:System.DateTime.MinValue?displayProperty=nameWithType> or later that <xref:System.DateTime.MaxValue?displayProperty=nameWithType>, this method returns <xref:System.DateTime.MinValue> or <xref:System.DateTime.MaxValue>, respectively.
## Examples
The following example illustrates the conversion of time values whose <xref:System.DateTime.Kind%2A> property is <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>, <xref:System.DateTimeKind.Local?displayProperty=nameWithType>, and <xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>, respectively. It also illustrates the conversion of ambiguous and invalid times.
:::code language="csharp" source="~/snippets/csharp/System/TimeZoneInfo/ConvertTimeBySystemTimeZoneId/System.TimeZone2.Conversions.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/TimeZoneInfo/ConvertTimeBySystemTimeZoneId/System.TimeZone2.Conversions.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone2.Conversions/vb/System.TimeZone2.Conversions.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<see langword="TimeZoneInfo.Local.IsInvalidDateTime(" />
<paramref name="dateTime" />
<see langword=")" /> returns <see langword="true" />.</exception>
<related type="Article" href="/dotnet/standard/datetime/converting-between-time-zones">Converting Times Between Time Zones</related>
</Docs>
</Member>
<Member MemberName="ConvertTimeToUtc">
<MemberSignature Language="C#" Value="public static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.DateTime ConvertTimeToUtc(valuetype System.DateTime dateTime, class System.TimeZoneInfo sourceTimeZone) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZoneInfo.ConvertTimeToUtc(System.DateTime,System.TimeZoneInfo)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ConvertTimeToUtc (dateTime As DateTime, sourceTimeZone As TimeZoneInfo) As DateTime" />
<MemberSignature Language="F#" Value="static member ConvertTimeToUtc : DateTime * TimeZoneInfo -> DateTime" Usage="System.TimeZoneInfo.ConvertTimeToUtc (dateTime, sourceTimeZone)" />
<MemberSignature Language="C++ CLI" Value="public:
 static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo ^ sourceTimeZone);" />
<MemberType>Method</MemberType>