What do you mean by 'calculate the night part of a flight'? It doesn't need calculating. It's whatever you note down as the duration spent flying during darkness.
Do you mean calculate a duration that begins before midnight & finishes after midnight? If so do a search - it's been covered a couple of times before on this forum.
edit: ooops....someone searched & found!