// DEFUNCT AS WE NO LONGER USE THE TIME ZONE //public DateTimeOffset GetDateTime(int dateTimeSearchTermIndex, TimeZoneInfo imageSetTimeZone) //{ // // Check the arguments for null // ThrowIf.IsNullArgument(imageSetTimeZone, nameof(imageSetTimeZone)); // DateTime dateTime = this.SearchTerms[dateTimeSearchTermIndex].GetDateTime(); // return DateTimeHandler.FromDatabaseDateTimeIncorporatingOffset(dateTime, imageSetTimeZone.GetUtcOffset(dateTime)); //} public DateTimeOffset GetDateTime(int dateTimeSearchTermIndex, TimeSpan offset) { // Get the date/time correcting for the offset, if any. // Note that as of this version, all offsets should be 0 so this may not be necessary DateTime dateTime = this.SearchTerms[dateTimeSearchTermIndex].GetDateTime(); return(DateTimeHandler.FromDatabaseDateTimeIncorporatingOffset(new DateTime((dateTime + offset).Ticks), TimeSpan.Zero)); }
public DateTimeOffset GetDateTime(int dateTimeSearchTermIndex, TimeZoneInfo imageSetTimeZone) { // Check the arguments for null ThrowIf.IsNullArgument(imageSetTimeZone, nameof(imageSetTimeZone)); DateTime dateTime = this.SearchTerms[dateTimeSearchTermIndex].GetDateTime(); return(DateTimeHandler.FromDatabaseDateTimeIncorporatingOffset(dateTime, imageSetTimeZone.GetUtcOffset(dateTime))); }
public void SetDatabaseValue(Nullable <DateTime> dateTime, TimeZoneInfo imageSetTimeZone) { // Check the arguments for null ThrowIf.IsNullArgument(imageSetTimeZone, nameof(imageSetTimeZone)); if (dateTime.HasValue) { TimeSpan utcOffset = imageSetTimeZone.GetUtcOffset(dateTime.Value); DateTimeOffset imageSetDateTime = DateTimeHandler.FromDatabaseDateTimeIncorporatingOffset(dateTime.Value, utcOffset); this.DatabaseValue = DateTimeHandler.ToStringDatabaseDateTime(imageSetDateTime); } else { this.DatabaseValue = null; } }