Create DateTimeOffset from specified DateTime value and offset in CSharp
Description
The following code shows how to create DateTimeOffset from specified DateTime value and offset.
Example
using System;/* ww w.j a v a 2 s . c o m*/
public class MainClass{
public static void Main(String[] argv){
DateTime localTime = new DateTime(2014, 07, 12, 06, 32, 00);
DateTimeOffset dateAndOffset = new DateTimeOffset(localTime,
TimeZoneInfo.Local.GetUtcOffset(localTime));
Console.WriteLine(dateAndOffset);
}
}
The code above generates the following result.