Danzoe’s Webloz
Just another Danzoe webloz !

Javascript – Tanggal/Date

Buat Hari, Bulan Tanggal, Tahun dengan javascript.

Example/Contoh : “ Wednesday, October 15, 2008

 

JavaScript :

<script language=javascript>

calendar = new Date();

day = calendar.getDay();

month = calendar.getMonth();

date = calendar.getDate();

year = calendar.getYear();

if (year < 1000)

year+=1900

cent = parseInt(year/100);

g = year % 19;

k = parseInt((cent – 17)/25);

i = (cent – parseInt(cent/4) – parseInt((cent – k)/3) + 19*g + 15) % 30;

i = i – parseInt(i/28)*(1 – parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));

j = (year + parseInt(year/4) + i + 2 – cent + parseInt(cent/4)) % 7;

l = i – j;

emonth = 3 + parseInt((l + 40)/44);

edate = l + 28 – 31*parseInt((emonth/4));

emonth–;

var dayname = new Array (“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”);

var monthname = 

new Array (“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”September”,”October”,”November”,”December” );

document.write(dayname[day] + “, “);

document.write(monthname[month] + ” “);

if (date< 10) document.write(“0” + date + “, “);

else document.write(date + “, “);

document.write(year);

//–>

</script>

Belum Ada Tanggapan to “Javascript – Tanggal/Date”

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: