first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

C# Code: An Example of Subtracting DateTime; Making the Future a Negative Number

var countDown = new TimeSpan(DateTime.Now.Subtract(epsDate.Value).Ticks);

data.DaysInterval = countDown.Days; data.IsDayOf = (countDown.Days == 0); data.IsPastDue = (countDown.Ticks > 0); data.IsWithinTwoWeeks = (countDown.Days <= -14);

var acronym = GetSymbolDuePrefix(symbolType); var due = (data.IsPastDue && (data.DaysInterval > 1)) ? "Past Due ".ToUpper() : "Due ".ToUpper(); var interval = "Today"; if (data.DaysInterval == 1) interval = "1 Day"; if ((Math.Abs(data.DaysInterval) > 1) && data.IsPastDue) interval = string.Format("{0} Days", Math.Abs(data.DaysInterval)); if ((Math.Abs(data.DaysInterval) > 1) && !data.IsPastDue) interval = string.Format("in {0} Days", Math.Abs(data.DaysInterval));

data.DisplayText = string.Concat(acronym, due, interval, " (e)");

mod date: 2010-02-24T00:27:34.000Z