I have a date field saved as Unix timestamp with site's timezone. I have a new local timezone field with limited options so that administrator users can enter the event date with the local timezone where that event actually happen.
I have created a view for the next immediate event by comparing the relative date. Using the result date, I need to display the counter like functionality,
for example 1 day, 30 hours, 15 minutes, 20 seconds.
var event_date = <?php echo $output;?>; var countdown = new Date (event_date).getTime(); var local_time = new Date().getTime(); var distance = countdown - local_time; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000);
It works, but only for the site's timezone. How do I show the date in the timezone entered for the event?