If you work any 3 hours between 11pm and 6am, then your maximum shift length is 8 hours by law.
Not always the case. Certainly for some jobs the shift length must not exceed 8 hours but for most jobs it is an average of 8 hours and there are many exemptions for particular industries including ATC and Flight Crew.