25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Date calculation 860 B

1234567891011121314151617181920212223242526
  1. //1- lowest to now
  2. //2 -highest to now
  3. function remaning_time(Выбранная_дата, Тип_отсчета){
  4. var tDate = new Date;
  5. var sec = 1000;
  6. var min = 60*sec;
  7. var hour = 60*min;
  8. var day = 24*hour;
  9. // 1 - means lowest date to current date
  10. if(Тип_отсчета == 1){
  11. var diff = tDate-Выбранная_дата;
  12. var days = Math.floor(diff/day);
  13. var hours = Math.floor(diff%day/hour);
  14. var minutes = Math.floor(diff%day%hour/min);
  15. return ['> ' + days + 'dd. ' + hours + 'hh. ' + minutes + 'mm.'];
  16. }
  17. // 2 - means highest date to current date
  18. if(Тип_отсчета == 2){
  19. var diff=Выбранная_дата-tDate;
  20. var days = Math.floor(diff/day);
  21. var hours = Math.floor(diff%day/hour);
  22. var minutes = Math.floor(diff%day%hour/min);
  23. return [days + 'д. ' + hours + 'ч. ' + minutes + 'м.'+ ' >'];
  24. }
  25. }