using System;
using System.Linq;
public class Program
{
public static void Main()
{
//Uncomment to get a list of timezones.
//foreach(var tz in TimeZoneInfo.GetSystemTimeZones()){
// Console.WriteLine(tz.Id);
//}
//Alaska
//first, create base DateTime
DateTime dtAlaska = new DateTime(2015,4,15,12,00,00);
//second, use datet ime to calc timespan, or assume local and convert. We will get timespan.
TimeSpan tsAlaska = TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time")
.GetUtcOffset(dtAlaska);
//last, put it together
DateTimeOffset dtoAlaska = new DateTimeOffset(2015,4,15,12,00,00,tsAlaska);
Console.WriteLine(dtoAlaska);
//Pacific
DateTime dtPacific = new DateTime(2015,4,15,12,00,00);
TimeSpan tsPacific = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")
.GetUtcOffset(dtPacific);
DateTimeOffset dtoPacific = new DateTimeOffset(2015,4,15,12,00,00,tsPacific);
Console.WriteLine(dtoPacific);
//Eastern
DateTime dtEastern = new DateTime(2015,4,15,12,00,00);
TimeSpan tsEastern = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
.GetUtcOffset(dtEastern);
DateTimeOffset dtoEastern = new DateTimeOffset(2015,4,15,12,00,00,tsEastern);
Console.WriteLine(dtoEastern);
DateTimeOffset[] dtaCollection = new DateTimeOffset[]{dtoAlaska,dtoPacific,dtoEastern};
Console.WriteLine(dtaCollection);
DateTimeOffset dtoMax = dtaCollection.Max();
Console.WriteLine(dtoMax);
}
}