Calculate midnight based on time.