Tutorial Membuat Countdown Timer Deposit Webpul

Tutorial kali ini saya akan share tentang cara membuat hitungan waktu mundur atau countdown time deposit, diharapkan setelah member melakukan request deposit untuk segera melakukan transfer.

Oke simak Tutorial Membuat Countdown Timer Deposit Webpul berikut.

  1. Buat Function di main_helper.php
function timer($wkt){    $shift = get_instance()->system->set['zona_waktu'] * 3600;    $tanggal = date('m-j-Y-H-i-s',$wkt + $shift);	$bulan = array (1 =>   'Jan',				'Feb',				'Mar',				'Apr',				'Mei',				'Jun',				'Jul',				'Aug',				'Sep',				'Oct',				'Nov',				'Dec'			);	$split = explode('-', $tanggal);	return $bulan[ (int)$split[0] ] . ' ' . $split[1] . ', ' . $split[2] . ' ' . $split[3] . ':' . $split[4] . ':' . $split[5];}

copas script di atas lalu paste kan di file application/helpers/main_helper.php

untuk penempatan posisi bisa lihat gambar di bawah

Penempatan posisi function

2. Edit file application/views/akun/deposit/view.php

<script>// Set the date we're counting down tovar countDownDate = new Date("<?php echo timer($trx->de_tanggal + (3600 * $deposit->time));?>").getTime();// Update the count down every 1 secondvar x = setInterval(function() {    // Get todays date and time    var now = new Date().getTime();        // Find the distance between now an 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);        // Output the result in an element with id="timer"    document.getElementById("timer").innerHTML = hours + " Jam "    + minutes + " Menit " + seconds + " Detik ";        // If the count down is over, write some text     if (distance < 0) {        clearInterval(x);        document.getElementById("timer").innerHTML = "EXPIRED";    }}, 1000);</script>

copas script di atas tepat di atas kode </body>

jika sudah lalu tambahkan lagi script di bawah

<div class="text-center"><strong>Batas Waktu Transfer</strong></div><div class="alert alert-info"><h4 id="timer" style="color: red;"></h4></div>

untuk penempatan script bisa lihat gambar di bawah

Tutorial Membuat Countdown Timer Deposit Webpul

Catatan : Silahkan di sesuaikan dengan tema dan tampilan webpul masing masing.