Membuat tanggal lengkap dengan JavaScript

Demo :

Versi Inggris



Versi Indonesia




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>



Credit: JavaScript Kit

Alhamdulillah

2 comments:


  1. aku coba copy di gadget ternyata bisa sob... makasih ya

    Ari Febriant's Blog™

  2. sama-sama sob...

Posting Komentar


Creative Commons License
Membuat tanggal lengkap dengan JavaScript by Nano Yulianto is licensed under a Creative Commons Attribution 3.0 Unported License.
Based on a work at http://nanoyulianto.blogspot.com/2011/01/membuat-tanggal-lengkap-dengan.html.
Permissions beyond the scope of this license may be available at http://nanoyulianto.blogspot.com/.