1

I am looking to get the past date precisely one week from current date in sql format in node js .I tried this -How to get yesterday date in node.js backend? but it does'nt seems to work for me

1 Answers1

1

Try Library called node-datetime

var datetime = require('node-datetime');
var dt = datetime.create();
// 7 day in the past
dt.offsetInDays(-7);
var formatted = dt.format('Y-m-d H:M:S');
console.log(formatted)
Shubham Dixit
  • 9,242
  • 4
  • 27
  • 46