Is this legal?

On the day you started at 3am you worked for 12 hours so you may have gone over the working hours for that day. It will depend on whether there is a work force agreement in place to opt out of the night time duties