P
P
Pamagiti2018-03-13 20:07:10
JavaScript
Pamagiti, 2018-03-13 20:07:10

How to properly set up the script?

Hello, I don't understand scripts, I need your help:

<script>var time=new Date();document.write('<b>' + Math.floor(((time.getTime()/1000) - $TIMESTAMP$)/86400) + '</b>'); 
 if(time % 10 == 1)
  time += " день назад";
 else if(time % 10 == 2 || time % 10 == 3 || time % 10 == 4)
 time += " дня назад";
 else
 time += " дней назад";
 document.write(time);</script>

This script needs to be rebuilt in such a way that the number of days that have passed since the value of $TIMESAMP$ and with declinations of days is displayed. Preferably output in id tag For example:
1 day ago, 2 days ago, 5 days ago...
Thank you in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Spiridonov, 2018-03-13
@customtema

https://freelansim.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question