public AlaskaDateTime AddYears(int value)
        {
            var dt = DateTime.Parse(Value);

            dt = dt.AddYears(value);
            return(AlaskaDateTime.Convert(dt.ToUniversalTime()));
        }
        public AlaskaDateTime AddSeconds(double value)
        {
            var dt = DateTime.Parse(Value);

            dt = dt.AddSeconds(value);
            return(AlaskaDateTime.Convert(dt.ToUniversalTime()));
        }
        public AlaskaDateTime AddMonths(int months)
        {
            var dt = DateTime.Parse(Value);

            dt = dt.AddMonths(months);
            return(AlaskaDateTime.Convert(dt.ToUniversalTime()));
        }
 /// <summary>
 /// TryParse a utc time string to get the alaska <see cref="DateTime"/>
 /// </summary>
 public static bool TryParse(string dateTime, out AlaskaDateTime alaskaDateTime)
 {
     try
     {
         alaskaDateTime = Parse(dateTime);
         return(true);
     }
     catch (Exception ex)
     {
         alaskaDateTime = default(AlaskaDateTime);
         return(false);
     }
 }
        public AlaskaDateTime(int year, int month, int day, int hour, int minute, int second)
        {
            Year   = year;
            Month  = month;
            Day    = day;
            Hour   = hour;
            Minute = minute;
            Second = second;

            var dateTimeParse =
                DateTime.Parse(string.Concat(Year, "-", Month.ToString("00"), "-", Day.ToString("00"), "T", Hour.ToString("00"), ":", Minute.ToString("00"), ":", Second.ToString("00"), "Z"))
                .ToUniversalTime();

            Offset = dateTimeParse.IsInDaylightSavingsTime() ? DaylightOffset : StandardOffset;

            Date      = new AlaskaDateTime(Year, Month, Day);
            DayOfYear = Date.DayOfYear;
            DayOfWeek = Date.DayOfWeek;
        }
        public AlaskaDateTime(long ticks)
        {
            var dateTime = new DateTime(ticks)
                           .ToUniversalTime()
                           .ToAlaska();

            Year        = dateTime.Year;
            Month       = dateTime.Month;
            Day         = dateTime.Day;
            Hour        = dateTime.Hour;
            Minute      = dateTime.Minute;
            Second      = dateTime.Second;
            Millisecond = dateTime.Millisecond;

            Offset = dateTime.IsInDaylightSavingsTime() ? DaylightOffset : StandardOffset;

            Date      = new AlaskaDateTime(Year, Month, Day);
            DayOfYear = Date.DayOfYear;
            DayOfWeek = Date.DayOfWeek;
        }
        public AlaskaDateTime(TimeSpan timeOfDay)
        {
            var alaskaNow = DateTime.UtcNow.ToAlaska();

            Year  = alaskaNow.Year;
            Month = alaskaNow.Month;
            Day   = alaskaNow.Day;

            Hour        = timeOfDay.Hours;
            Minute      = timeOfDay.Minutes;
            Second      = timeOfDay.Seconds;
            Millisecond = timeOfDay.Milliseconds;

            var dateTimeParse =
                DateTime.Parse(string.Concat(Year, "-", Month.ToString("00"), "-", Day.ToString("00"), "T", Hour.ToString("00"), ":", Minute.ToString("00"), ":", Second.ToString("00"), ".", Millisecond.ToString("00"), "Z"))
                .ToUniversalTime()
                .ToAlaska();

            Offset = dateTimeParse.IsInDaylightSavingsTime() ? DaylightOffset : StandardOffset;

            Date      = new AlaskaDateTime(Year, Month, Day);
            DayOfYear = Date.DayOfYear;
            DayOfWeek = Date.DayOfWeek;
        }