public static IMilDate GetMilDate(DateTime?date, string milTimeZoneAbbreviation) { IMilDate mdto = new MilDate(); if (!date.HasValue) { return(mdto); } var mtz = MilTimeZones.FirstOrDefault(i => milTimeZoneAbbreviation != null && i.Abbreviation.Equals(milTimeZoneAbbreviation, StringComparison.InvariantCulture)); mdto.DTZ = mtz; if (mtz != null) { mdto.MilDateOffset = new DateTimeOffset(date.Value, mtz.TimeZoneInfo.BaseUtcOffset); } return(mdto); }
public static IMilDate GetMilDateFromString(string dateTimeGroupString) { IDtgTransform dT = new DtgTransform(dateTimeGroupString); var date = GetDateTime(dT); IMilDate mdto = new MilDate(); if (!date.HasValue) { return(mdto); } var mtz = MilTimeZones.FirstOrDefault(i => i.Abbreviation != null && i.Abbreviation.Equals(dT.MilTimeZoneAbbreviation, StringComparison.InvariantCulture)); mdto.DTZ = mtz; if (mtz != null) { mdto.MilDateOffset = new DateTimeOffset(date.Value, mtz.TimeZoneInfo.BaseUtcOffset); } return(mdto); }