Aspectacular.DateTimeExtensions.ToSortableIntTime C# (CSharp) Method

ToSortableIntTime() public static method

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.
public static ToSortableIntTime ( this dt, bool includeMilliseconds = false ) : int
dt this
includeMilliseconds bool
return int
        public static int ToSortableIntTime(this DateTime dt, bool includeMilliseconds = false)
        {
            long sortableTime = ToSortableLongTime(dt, includeMilliseconds);
            if(sortableTime > int.MaxValue)
                throw new Exception("{0:#,#0} value exceeds maximum integer value".SmartFormat(sortableTime));

            return (int)sortableTime;
        }