'Date is displaying weird times in query?
I got this query here
db.query("SELECT developers.id, developers.name, absent.absentday, developers.selected, date.date FROM developers LEFT OUTER JOIN absent ON absent.absentName = developers.name LEFT OUTER JOIN date ON date.dateName = developers.name;",
(err, result, fields) => {
if (err) {
console.log(err);
} else {
result_database = Object.values(JSON.parse(JSON.stringify(result)));
console.log("Result from all Database Rows", result_database);
resultStatement();
}
})
I'm not finding anything weird to this query. But for some reason my dates are returned weirdly. What it should be
{
id: 57,
name: 'tom hiddle',
absentday: null,
selected: 1,
date: '2022-05-16'
},
What I'm getting In return
{
id: 57,
name: 'tom hiddle',
absentday: null,
selected: 1,
date: '2022-05-15T22:00:00.000Z'
},
The 2022-05-16 is turned into 15 from a day ago, also the time is being displayed for no reason. The date type is date. When I run my query in the database it returns the value normal as it should be. Anyone that can help me here?
(Sorry I know there are other threads for this but I'm just wondering if there is a better solution for this? None of the answers work for me in the other threads)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
