DateTimeHelperConvertTimeZoneToLocal Method |
Converts time zone of date to current time zone.
Namespace:
Xcalibur.Helpers
Assembly:
Xcalibur.Helpers (in Xcalibur.Helpers.dll) Version: 1.0.1.0 (1.0.1.0)
Syntax public static DateTime ConvertTimeZoneToLocal(
this DateTime date
)
<ExtensionAttribute>
Public Shared Function ConvertTimeZoneToLocal (
date As DateTime
) As DateTime
public:
[ExtensionAttribute]
static DateTime ConvertTimeZoneToLocal(
DateTime date
)
[<ExtensionAttribute>]
static member ConvertTimeZoneToLocal :
date : DateTime -> DateTime
Parameters
- date
- Type: SystemDateTime
The date.
Return Value
Type:
DateTimeUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Examples 1static void Main(string[] args)
2{
3
4 var date = new DateTime(2017, 1, 1, 0, 0, 0, DateTimeKind.Utc);
5 Console.WriteLine($"Date in GMT:\n{date:MM/dd/yyyy HH:mm:ss}");
6
7
8 Console.WriteLine();
9
10
11 Console.WriteLine($"Date in EST:\n{date.ConvertTimeZoneToLocal():MM/dd/yyyy HH:mm:ss zzz}");
12
13
14 Console.Read();
15}
16
17
See Also