Cara mengetahui Selisih Date Di Javascript


date

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);

$$(‘richText11’).setValue(days);
return false;

terus tinggal kita panggil aja function itu di event onclick nya. hehe

button2.click = function button2_click (event)
{
// Add your code here
dateDiff();
};

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s