Formula for Time Categories Including Sort Order