title: Sequelize mysql reads timezone incorrectly from mysql database
body: <p>I'm using sequelize in node.js application and mysql as a database but the problem is, when I read data from the MySQL table, the timezone is read incorrectly.</p>
  <p>I want to use <strong>IST(Indian Standard Time) or 'Asia/Calcutta'</strong> as a timezone for both reading and writing to the MySQL database.</p>
  <p>I've tried this <a href="https://stackoverflow.com/questions/47367893/sequelize-reads-datetime-in-utc-only">Sequelize reads datetime in UTC only</a> configuration <strong>but the problem is solved partially i.e. only for writing to database.</strong> <strong>But, it still exists while reading the date-time from database.</strong></p>
  <p><strong>See, the configuration below to understand it better. I've also attached screenshot of incorrect timezone read from the DB.</strong></p>
  <p><strong>Version Details:</strong>
  &quot;mysql2&quot;: &quot;^2.3.0&quot;,
  &quot;sequelize&quot;: &quot;^6.6.5&quot;</p>
  <p><a href="https://i.stack.imgur.com/nUoQT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nUoQT.png" alt="incorrect-timezone-img" /></a></p>
  <p><strong>Table Structure in Mysql Database:</strong>
  <a href="https://i.stack.imgur.com/CYXlF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CYXlF.png" alt="invoice-table-structure" /></a></p>
  <p><strong>Table data with correct date and time.</strong>
  <a href="https://i.stack.imgur.com/O910I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O910I.png" alt="invoice-table-with-correct-datetime" /></a></p>
  <p><strong><code>Note:</code></strong> The issue is only in reading the DateTime from the database and not for storing.</p>
  <p><strong>Sequelize Model Class:</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>module.exports = (sequelize, DataTypes) =&gt; {
      const Invoice = sequelize.define('Invoice', {
          invoiceId: {
              type: DataTypes.INTEGER.UNSIGNED,
              allowNull: false,
              autoIncrement: true,
              primaryKey: true
          },
  
          invoiceNumber: {
              type: DataTypes.INTEGER(6).UNSIGNED.ZEROFILL,
              allowNull: false,
              unique: true
          }, 
  
          description: {
              type: DataTypes.TEXT,
              allowNull: false
          },
  
          discount: {
              type: DataTypes.DECIMAL(9,2),
              allowNull: false,
              defaultValue: 0.00
          },
  
          invoiceTotal: {
              type: DataTypes.DECIMAL(9,2),
              allowNull: false,
              defaultValue: 0.00
          },
  
          paymentTotal: {
              type: DataTypes.DECIMAL(9,2),
              allowNull: false,
              defaultValue: 0.00
          },
  
          invoiceDate: {
              type: DataTypes.DATE,
              defaultValue: DataTypes.NOW,
              allowNull: false
          }
  
      }, {
          underscored: true // will add underscore in field name of database instead of storing camel case notation in db
      });
  
      Invoice.associate = function (model) {
          Invoice.belongsTo(model.Customer, {
              foreignKey: {
                  name: "cust_id",
                  allowNull: false
              } 
          });
      };
  
      return Invoice;
  }</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const sequelize = new Sequelize(
      config.get('db.database'),  // reading from configuration file
      config.get('db.user'), 
      config.get('db.password'), {
          host: config.get('db.host'), 
          dialect: 'mysql',
          dialectOptions: {
              useUTC: false, //for reading from database
              dateStrings: true,
              typeCast: function (field, next) { // for reading from database
              if (field.type === 'DATETIME') {
                return field.string()
              }
              return next()
            },
          },
          timezone: 'Asia/Calcutta'
  });</code></pre>
  </div>
  </div>
  </p>