Skip to content

Instantly share code, notes, and snippets.

@ihorkatkov
Created July 25, 2015 11:13
Show Gist options
  • Save ihorkatkov/6cdbd49f5901fb70be9a to your computer and use it in GitHub Desktop.
Save ihorkatkov/6cdbd49f5901fb70be9a to your computer and use it in GitHub Desktop.
[JS] getDateAgo(date, days) - возвращает число, которое было days дней назад от даты date.
function getDateAgo(date, days) {
var newDate = new Date(date);
newDate.setDate(newDate.getDate() - days)
return newDate.getDate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment