tset tset - 1 year ago 106
Node.js Question

Node.js date format conversion without using modules

Date format conversion without using modules

The following code converts the date into different format: "2016-09-16T04:48:29.250Z"

var date = new Date().toISOString();

How do I subtract 14 days and then convert the date into the same format?

var date = new Date();

Answer Source

You're very close. Just do:

var date = new Date();
date.setDate(date.getDate() - 14);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download