Buonasera
al momento sto utilizzando un countdown che per farlo funzionare devo inserire la variabile $countdown_scadenza in questo modo:
vorrei pero' modificarla e prendere il valore dal server che inserisco tramite mysql in questo modo:codice:May 10, 2022 20:00:00
Questo è il mio attuale codice, come potrei modificarlo per farlo funzionare?codice:2022-05-10 20:00:00
Graziecodice:<script> // Set the date we're counting down to var countDownDate = new Date("<?=$countdown_scadenza?>").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now and the count down date var distance = countDownDate - now; // Time calculations for days, hours, minutes and seconds 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); // Display the result in the element with class="promo" var promo = document.getElementsByClassName("promo"); for(var i = 0; i < promo.length; i++) { promo[i].innerHTML = days + " GIORNI " + hours + " ORE " + minutes + " MINUTI " + seconds + " SECONDI "; } // If the count down is finished, write some text if (distance < 0) { clearInterval(x); var promo = document.getElementsByClassName("promo"); for(var i = 0; i < promo.length; i++) { promo[i].innerHTML = "Promo Scaduta! (contattaci ugualmente)"; } } }, 1000); </script>

Rispondi quotando


