SHARE
TWEET

Untitled

a guest Apr 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function timeConvert(date) {
  2.   //
  3.   let timeDifference = Math.floor(((new Date().getTime()/1000) - date));
  4.   var second = timeDifference;
  5.   var minute = Math.floor(timeDifference / 60);
  6.   var hour = Math.floor(timeDifference / 3600);
  7.   var day = Math.floor(timeDifference / 86400);
  8.   var week = Math.floor(timeDifference / 604800);
  9.   var month = Math.floor(timeDifference / 2419200);
  10.   var year = Math.floor(timeDifference / 29030400);
  11.   //
  12.   if(second < 60){
  13.     if (second == 0)
  14.       return "şuan";
  15.     else
  16.       return second + " saniye önce";
  17.   }
  18.   else if (minute < 60)
  19.     return minute + " dakika önce";
  20.   else if (hour < 24)
  21.     return hour + " saat önce";
  22.   else if (day < 7)
  23.     return day + " gün önce";
  24.   else if (week < 4)
  25.     return week + " hafta önce";
  26.   else if (month < 12)
  27.     return month + " ay önce";
  28.   else
  29.     return year + " yıl önce";
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top