title: How to .Scan() a MySQL TIMESTAMP value into a time.Time variable?
body: <p>I have this Go code:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "database/sql"
      _"github.com/go-sql-driver/mysql"
      "time"
  )
  
  type User struct {
      id                  uint32
      name                string
      email               string
      rating              uint8
      subscription        uint8
      date_registered     time.Time
      online              string
  }
  
  // main entry point
  func main() {
      // setup db connection
      db, err := sql.Open("mysql", "user:@tcp(127.0.0.1:3306)/c9?parseTime=true")
      if err != nil {
          fmt.Println(err)
      }
      defer db.Close()
  
      // query
      rows, err := db.Query("SELECT * FROM users WHERE id = ?", 1)
      if err != nil {
          fmt.Println(err)
      }
      defer rows.Close()
  
      usr := User{}
      for rows.Next() {
          err := rows.Scan(&amp;usr.id, &amp;usr.name, &amp;usr.email, &amp;usr.rating, &amp;usr.subscription, &amp;usr.date_registered, &amp;usr.online)
          if err != nil {
              fmt.Println(err)
          }
      }
      fmt.Println(usr)
      err = rows.Err()
      if err != nil {
          fmt.Println(err)
      }
  }
  </code></pre>
  
  <p>This is what I get from MySQL console:</p>
  
  <pre><code>mysql&gt; describe users;
  +-----------------+---------------------+------+-----+-------------------+----------------+
  | Field           | Type                | Null | Key | Default           | Extra          |
  +-----------------+---------------------+------+-----+-------------------+----------------+
  | id              | int(10) unsigned    | NO   | PRI | NULL              | auto_increment |
  | name            | varchar(50)         | NO   |     | NULL              |                |
  | email           | varchar(50)         | NO   |     | NULL              |                |
  | rating          | tinyint(3) unsigned | YES  |     | NULL              |                |
  | subscription    | tinyint(3) unsigned | NO   |     | 0                 |                |
  | date_registered | timestamp           | NO   |     | CURRENT_TIMESTAMP |                |
  | online          | char(1)             | NO   |     | N                 |                |
  +-----------------+---------------------+------+-----+-------------------+----------------+
  7 rows in set (0.00 sec)
  
  mysql&gt; SELECT * FROM users;
  +----+------------+-----------------------+--------+--------------+---------------------+--------+
  | id | name       | email                 | rating | subscription | date_registered     | online |
  +----+------------+-----------------------+--------+--------------+---------------------+--------+
  |  1 | alakhazamm | abcdefghhhh@gmail.com |   NULL |            0 | 2014-10-28 15:37:44 | N      |
  +----+------------+-----------------------+--------+--------------+---------------------+--------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <hr>
  
  <p>After <code>.Scan()</code>, <code>fmt.Println(usr)</code> prints</p>
  
  <pre><code>{1 alakhazamm abcdefghhhh@gmail.com 0 0 {0 0 &lt;nil&gt;} }
  </code></pre>
  
  <p>The last two fields of the struct are wrong but I have no idea why.
  I've tried using <code>date_registered string</code> in the struct definition, but I get an empty string after <code>.Scan()</code>.
  I've also read in the driver's docs that <code>?parseTime=true</code> parses MySQL DATE and DATETIME values into time.Time, but they don't mention TIMESTAMP which is what I'm currently using.</p>
  
  <p>Am I missing something important or is it a bug/missing feature of the library?</p>