I am trying to get data that is at least three months fresh, using moment js but keep getting this error:
get userPassed error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `_isUTC` = false, `_pf` = '[object Object]', `_locale` = '[object Object]', `_d' at line 1
Here is my code using nodejs with momentjs and mysql:
var today = new Date();
var threeMonthsAgo = moment.utc(today).subtract(3, 'months').format("YYYY-MM-DD HH:mm:ss").toISOString();
var qSelect = "SELECT id FROM Dislikes WHERE user_id = ? AND disliked_by_id = ? AND date_added > ?";
var qValues = [user_profile_id, user_pref_id, threeMonthsAgo];
var qCall = mysql.format(qSelect, qValues);
connection.query(qCall, function(err, userPassed, fields) {
if (err) {
console.log("get userPassed error: " + err);
Any ideas, I tried messing with the format of the date so far by adding utc and even the same setup for mysql