Aspectacular.DateTimeExtensions.ToSortableLongTime C# (CSharp) Method

ToSortableLongTime() public static method

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.
public static ToSortableLongTime ( this dt, bool includeMilliseconds = false ) : long
dt this
includeMilliseconds bool
return long
        public static long ToSortableLongTime(this DateTime dt, bool includeMilliseconds = false)
        {
            long retVal = (dt.Hour*100 + dt.Minute)*100 + dt.Second;

            if(includeMilliseconds)
                retVal = retVal*1000 + dt.Millisecond;

            return retVal;
        }