Syntax:
TimeZoneInfo TimeZoneInfo.FindSystemTimeZoneById(string zoneId);
Parameter(s):
- zoneId: Time zone identifier.
Return value:
This method returns the object of TimeZoneInfo.
Exception(s):
- System.OutOfMemoryException
- System.ArgumentNullException
- System.TimeZoneNotFoundException
- System.Security.SecurityException
- System.InvalidTimeZoneException
ConvertTimeFromUtc():
This method is used to convert UTC time according to the specified time zone.
Syntax:
DateTime TimeZoneInfo.ConvertTimeFromUtc(DateTime dt, TimeZoneInfo destTimeZone);
Parameter(s):
- zoneId: Represents the coordinated Universal Time (UTC)
- destTimeZone: Represents the time zone to convert
Return value:
It returns date-time according to the specified time zone from UTC time.
Exception(s):
- System.ArgumentException
- System.ArgumentNullException
-
Program:
The source code to get the system time by Zone Id is given below. The given program is compiled and executed successfully.
Output: