Membuat tanggal lengkap dengan JavaScript

|

Demo :

Versi Inggris
Friday, 01 April, 2011

Versi Indonesia
Jum'at, 01 April, 2011


Kode

Penempatan kode :
dibawah <body>
........
diatas </body>

Copy-Paste :
Versi Inggris
<script type='text/javascript'>
//<![CDATA[
/* 
JavaScript Kit (http://www.javascriptkit.com/script/cut164.shtml)
*/

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<font color='000000' face='Arial'><b>"+dayarray[day]+", "+daym+" "+montharray[month]+", "+year+"</b></font>")
//]]>
</script>

Versi Indonesia
<script type='text/javascript'>
//<![CDATA[
/* 
JavaScript Kit (http://www.javascriptkit.com/script/cut164.shtml)
*/

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Minggu","Senin","Selasa","Rabu","Kamis","Jum'at","Sabtu")
var montharray=new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember")
document.write("<font color='000000' face='Arial'><b>"+dayarray[day]+", "+daym+" "+montharray[month]+", "+year+"</b></font>")

//]]>
</script>


0 komentar:

Posting Komentar

Next Prev
▲Top▲