To Date Time Offset - CSharp System

CSharp examples for System:DateTimeOffset

Description

To Date Time Offset

Demo Code

// Copyright (C) 2006-2015 Esper Team. All rights reserved.                           /
using System.Text.RegularExpressions;
using System.Globalization;
using System;/*  w  ww  .  j a  va 2  s  . co m*/

public class Main{
        public static DateTimeOffset ToDateTimeOffset(this DateTime dateTime, TimeZoneInfo timeZone)
        {
            return new DateTimeOffset(dateTime, timeZone.GetUtcOffset(dateTime));
        }
}

Related Tutorials