RSS

Menambahkan jam dan tanggal pada WordPress Offline

20 Mei

Copy paste kode dibawah ini untuk menampilkan tanggal dan hari serta jam pada wordpress offline.

Tanggal dan hari

<script> var tod=new Date(); var weekday=new Array(“Minggu”,”Senin”,”Selasa”,”Rabu”,”Kamis”,”Jum’at”,”Sabtu”); var monthname=new Array(“Januari”,”Februari”,”Maret”,”April”,”Mei”,”Juni”,”Juli”,”Agustus”,”September”,”Oktober”,”November”,”Desember”); var y = tod.getFullYear();  var m = tod.getMonth(); var d = tod.getDate(); var dow = tod.getDay(); var dispTime = ” ” + weekday[dow] + “, ” + d + ” ” + monthname[m] + ” ” + y + ” “; if (dow==0) dispTime= “<font color=red>” + dispTime + “</font>”; else if (dow==5) dispTime= “<font color=green>” + dispTime + “</font>”; else dispTime= “<font color=black>” + dispTime + “</font>”;  document.write(dispTime); </script>

Menampilkan Jam

<script> function clock() { var digital = new Date(); var hours = digital.getHours(); var minutes = digital.getMinutes(); var seconds = digital.getSeconds(); var amOrPm = “AM”;  if (hours > 11) amOrPm = “PM”; if (hours > 12) hours = hours – 12;if (hours == 0) hours = 12; if  (hours <= 9) hours = “0” + hours; if (minutes <= 9) minutes = “0” + minutes; if (seconds <= 9) seconds = “0” + seconds;  dispTime = hours + “:” + minutes + “:” + seconds + ” ” + amOrPm; if (navigator.appName==”Netscape”) { dispTime = hours + “:” + minutes + ” ” + amOrPm;  document.write (dispTime); return; }  if (document.layers) {  document.layers.jamdigital.document.write(dispTime);  document.layers.jamdigital.document.close(); } else if (document.all) jamdigital.innerHTML = dispTime; setTimeout(“clock()”, 1000); } document.write(‘<span id=”jamdigital” xstyle=”font-weight:bold;”></span>’); clock();  </script>

Jam sederhana

<?php date('h:m:s'); ?>

Semoga bermanfaat Ö

 
 

One response to “Menambahkan jam dan tanggal pada WordPress Offline

  1. akbarialfajri08

    26 Februari 2014 at 22:22

    thanks infonya gan, kunjungi ya
    http://akbarialfajri08.wordpress.com

     

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

 
%d blogger menyukai ini: