Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calcDate(target,message) {
- var today = new Date();
- var past = target;
- var diff = Math.floor(today.getTime() - past.getTime());
- var day = 1000* 60 * 60 * 24;
- var days = Math.floor(diff/day);
- var months = Math.floor(days/30);
- days = days%30;
- var years = Math.floor(months/12);
- months = months%12;
- console.log("MeBeiM's timer-since.js >> Loaded");
- if ((months!=0) && (days!=0)) var andmonths=true;
- if ((years!=0) && (months!=0) && (days!=0)) var commayears=true;
- if ((years!=0) && (months!=0) && (days==0)) var andyears=true;
- if ((years!=0) && (months==0) && (days!=0)) var andyears=true;
- (days>0) ? ((days>1) ? days = "<b>"+days.toString()+"</b> days" : days = "<b>"+days.toString()+"</b> day") : days = "";
- (months>0) ? ((months>1) ? months = "<b>"+months.toString()+"</b> months" : months = "<b>"+months.toString()+"</b> month") : months = "";
- (years>0) ? ((years>1) ? years = "<b>"+years.toString()+"</b> years" : years = "<b>"+years.toString()+"</b> year") : years = "";
- if (andmonths) months+=" and ";
- if (andyears) years+=" and ";
- if (commayears) years+= ", ";
- message = message.replace('%%TIME%%',years+months+days);
- document.write(message);
- if (location.hostname != "passivelove.tk")
- document.write('<a href="" target="_blank" style="position: absolute;left: 3px;bottom: 0px;font-size: 14px;color: #D3D3D3;text-decoration:none;" title="Tab#1 by passivelove"></a>');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement