Knex: MySQL date type how to use local time zone during insert/update

Created on 9 Dec 2013  路  1Comment  路  Source: knex/knex

Hi, I noticed that the query builder generated time as UTC timezone? Is it possible to use local time zone instead?

question

Most helpful comment

Just set the timezone option in the config object passed to initialize:

var knex = Knex.initialize({
  client: 'mysql',
  connection: {
    timezone : "+00:00"
    host     : '127.0.0.1',
    user     : 'your_database_user',
    password : 'your_database_password',
    database : 'myapp_test',
    charset  : 'utf8'
  }
});

See https://github.com/felixge/node-mysql#connection-options for option information

>All comments

Just set the timezone option in the config object passed to initialize:

var knex = Knex.initialize({
  client: 'mysql',
  connection: {
    timezone : "+00:00"
    host     : '127.0.0.1',
    user     : 'your_database_user',
    password : 'your_database_password',
    database : 'myapp_test',
    charset  : 'utf8'
  }
});

See https://github.com/felixge/node-mysql#connection-options for option information

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tjwebb picture tjwebb  路  3Comments

nklhrstv picture nklhrstv  路  3Comments

npow picture npow  路  3Comments

rarkins picture rarkins  路  3Comments

saurabhghewari picture saurabhghewari  路  3Comments