How to convert MYSQL Timestamp to CST time with Javascript?

Viewed 22

If someone could help me with this I´d appreciate it! I need to convert MYSQL Timestamp 2022-09-14T05:08:32.000Z to my local time (Central Standard Time) and then be able to pass that result to EJS. I am passing the data to my EJS view with this route, but not sure how to convert this timestamp before passing it to EJS.

This screenshot shows the 'rows' values which are being passed to EJS.

MYSQL Timestamp


rutas.get('/historial', loggedIn, async (req, res, next) => {
    await pool.query('SELECT * FROM historial WHERE id = ? AND  calidaddeltrade = ? OR calidaddeltrade = ?', [req.user.id, 'Excelente', 'Buena'], function (err, rows, fields) {
        if (err) { throw err };
        res.render('./historial', { rows: rows});
        console.log(rows);

    })
});

Does anyone know how could I do this with Javascript? Thanks!!

0 Answers
Related