Cara mengetahui Selisih Date Di Javascript


tadi abis cari cari codingan in. eh nemu juga, mencari selisih date di javascript.

semoga bermanfaat brow…

function dateDiff() {
var dtFrom = document.getElementById('textField1').value;
var dtTo = document.getElementById('textField2').value;

var dt1 = new Date(dtFrom);
var dt2 = new Date(dtTo);
var diff = dt2.getTime() – dt1.getTime();
var days = diff/(1000 * 60 * 60 * 24);

return false;

terus tinggal kita panggil aja function itu di event onclick nya. hehe = function button2_click (event)
// Add your code here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.