How to implement a custom countdown timer with dynamic inputs

I have a timestamp of start time, end time and want to implement a countdown based on these values and current time

Calculate the time missing to the end, and then just probably via a loop do the countdown magic.