C# TimeZoneInfo BaseUtcOffset

Description

TimeZoneInfo BaseUtcOffset gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).

Syntax

TimeZoneInfo.BaseUtcOffset has the following syntax.


public TimeSpan BaseUtcOffset { get; }

Example

The following example uses the BaseUtcOffset property to display the difference between the local time and Coordinated Universal Time (UTC).


/*from  ww  w.  ja  v a2s. c om*/
using System;
public class MainClass{
  public static void Main(String[] argv){  
    TimeZoneInfo localZone = TimeZoneInfo.Local;
    Console.WriteLine(localZone.BaseUtcOffset.Hours); 
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version