コード例 #1
0
        // 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));
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
ファイル: SearchTerm.cs プロジェクト: ben-norton/Timelapse
        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;
            }
        }