public static long ToSortableLongDateTime(this DateTime dt, bool includeMilliseconds = false) { long multiplier = includeMilliseconds ? 1000000000 : 1000000; long result = ToSortableIntDate(dt)*multiplier + ToSortableLongTime(dt, includeMilliseconds); return result; }