Get For Time Zone - CSharp System

CSharp examples for System:DateTime Timezone

Description

Get For Time Zone

Demo Code


using System.Security.Cryptography;
using System.Text;
using System;/* www . j  av a  2  s .  co  m*/

public class Main{
        public static DateTimeOffset GetForTimeZone(string date, string time, string timeZoneId)
    {
      var tz = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
      DateTime dt = DateTime.Parse(string.Format("{0} {1}", date, time));
      return new DateTimeOffset(dt, tz.GetUtcOffset(dt));
    }
}

Related Tutorials