title: The DATE change from MySQL to NodeJS
body: <p>Hi I´m using MySQL with NodeJS (<a href="https://www.npmjs.com/package/mysql" rel="nofollow noreferrer">https://www.npmjs.com/package/mysql</a>)</p>
  
  <p>In Node Js I´m using MomentJS (<a href="https://momentjs.com/docs/" rel="nofollow noreferrer">MomentJS</a>)</p>
  
  <p>I do an INSERT with a DATETIME, I get the date this way</p>
  
  <pre><code>incomes.registerdate = this.FechaRegistro.utc().format('YYYY-MM-DDTHH:mm:ss') //2019-11-20 22:02:42
  </code></pre>
  
  <p>The Date is storage correctly, but when I select the row in NodeJs the date change</p>
  
  <pre><code>RowDataPacket {
    item: '501021',
    description: 'CLAMP, 2" MUFFLER',
    price: 13,
    quantity: 13,
    rack: 'B-55',
    status: '1',
    registerdate: 2019-11-21T04:02:42.000Z,
    trackingnumber: 'test'
  }
  </code></pre>
  
  <p>Why? I want get the same time that I inserted.</p>
  
  <p>NodeJs is runing in localhost and MySQL is in a Server(Azure)</p>
  
  <p>UPDATE</p>
  
  <p>I found the problem.</p>
  
  <p>The package mysql (<a href="https://www.npmjs.com/package/mysql" rel="nofollow noreferrer">https://www.npmjs.com/package/mysql</a>), force date types (TIMESTAMP, DATETIME, DATE) to be returned like Object type Date(), but when NodeJS use the string got from MySQL  is used as localtime, but is UTC time.</p>
  
  <p>In the conection we have an option to force date types  to be returned as strings </p>
  
  <pre><code>var mysql = require('mysql'),
      conf = require('./db-conf'),
      dbOptions = {
          host : conf.mysql.host,
          port : conf.mysql.port,
          user : conf.mysql.user,
          password : conf.mysql.pass,
          database : conf.mysql.db,
          dateStrings:true
      },
      myConn = mysql.createPool(dbOptions);
  
  
  module.exports = myConn;
  </code></pre>
  
  <p>When I put this option in true all work fine, but how can I forse NodeJS to use the time in UTC instead of local</p>