-
-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createConnection timezone not working #888
Comments
Chiming in to add that timezone definitely has no effect. In However in the latter does not read or check timezone from the connection config at all, and instead just formats from a parsed string to a const dateString = row.CreateDate as string;
const utcDate= new Date(dateString.replace(/\s/, 'T')+'Z'); Personally, I am going to switch back to using |
This is addressed in the second part here: https://github.com/sidorares/node-mysql2/tree/master/documentation#known-incompatibilities-with-node-mysql and worked great for me. Add their |
The workaround using |
Hi guys,
in below code timezone setting does not seem to have any effort , i think its the issue with the driver could anyone help ?
my sql DB timezone : "-08:00"
application time : "+05:30"
yes this needs to be handled at app level. DB cant change.
var mysql = require('mysql');
//connect to db
var dbCon = mysql.createConnection({
host: "xxxx",
user: "xxxxx",
password: "xxxxx",
database:"xxxx",
timezone:"+05:30"
});
//db connection
dbCon.connect(function(err) {
if (err) throw err;
console.log("DB Connected!");
});
var dbCon = db.dbCon;
//query functions
function get_total_sales(startDate, endDate, callback) {
dbCon.query("SELECT sum(Paid) as total_sales, count(Paid) as item_soled FROM
orders
WHERE DateCreated >= " + mysql.escape(startDate) + " AND DateCreated <= " + mysql.escape(endDate) + " ",function (err, result, fields) {
if (err) {
throw err;
} else {
}
get_total_sales(startDate, endDate, writeToFile);
The text was updated successfully, but these errors were encountered: