title: sql: Scan error on column index 2, name "created_on": converting driver.Value type time.Time
body: <p>The way I query：</p>
  
  <pre><code>package models
  
  import (
      "fmt"
      "log"
  
      "github.com/jinzhu/gorm"
      //postgres dv
      _ "github.com/jinzhu/gorm/dialects/postgres"
  
      "ginstatus/pkg/setting"
  )
  
  var db *gorm.DB
  
  type Model struct {
      ID         int `gorm:"primary_key" json:"id"`
      CreatedOn  int `json:"created_on"`
      ModifiedOn int `json:"modified_on"`
  }
  
  func init() {
      var (
          err                                                     error
          dbType, dbName, user, password, host, port, tablePrefix string
      )
  
      sec, err := setting.Cfg.GetSection("database")
      if err != nil {
          log.Fatal(2, "Fail to get section 'database': %v", err)
      }
  
      dbType = sec.Key("TYPE").String()
      dbName = sec.Key("NAME").String()
      user = sec.Key("USER").String()
      password = sec.Key("PASSWORD").String()
      host = sec.Key("HOST").String()
      port = sec.Key("PORT").String()
      tablePrefix = sec.Key("TABLE_PREFIX").String()
  
      db, err = gorm.Open(dbType, fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s",
          host,
          port,
          user,
          dbName,
          password))
      // db, err = gorm.Open("postgres", "host=192.168.2.200 port=5433 user=czxsql dbname=go_blog password=123456")
  
      if err != nil {
          log.Println(err)
      }
      //##############################
      // db.LogMode(true)
      //##############################
  
      gorm.DefaultTableNameHandler = func(db *gorm.DB, defaultTableName string) string {
          return tablePrefix + defaultTableName
      }
  
      db.SingularTable(true)
      db.DB().SetMaxIdleConns(10)
      db.DB().SetMaxOpenConns(100)
  }
  
  func CloseDB() {
      defer db.Close()
  }
  
  </code></pre>
  
  <pre><code>package models
  
  type Tag struct {
      Model
  
      Name       string `json:"name"`
      CreatedBy  string `json:"created_by"`
      ModifiedBy string `json:"modified_by"`
      State      int    `json:"state"`
  }
  
  func GetTags(pageNum int, pageSize int, maps interface{}) (tags []Tag) {
      db.Where(maps).Offset(pageNum).Limit(pageSize).Find(&amp;tags)
  
      return
  }
  </code></pre>
  
  <p>/Database data information</p>
  
  <p><a href="https://i.stack.imgur.com/ZITOP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZITOP.png" alt="enter image description here"></a></p>
  
  <p>My results</p>
  
  <pre><code>"lists":[{"id":1,"created_on":0,"modified_on":0,"name":"czxtable","created_by":"","modified_by":"","state":0}]
  </code></pre>
  
  <pre><code>sql: Scan error on column index 2, name "created_on": converting driver.Value type time.Time ("2019-11-09 18:33:14.923411 +0000 +0000") to a int: invalid syntax 
  </code></pre>
  
  <p>The above is a postgresql query error,</p>
  
  <p>My database time field type "timestamp"</p>
  
  <p>I am using "github.com/jinzhu/gorm" to query the database, but the query result is "0".</p>
  
  <p>What should I do when I query, can I get the correct time format?</p>
  
  <p>ps:<a href="https://gorm.io/docs/connecting_to_the_database.html" rel="nofollow noreferrer">https://gorm.io/docs/connecting_to_the_database.html</a>  </p>
  
  <p>There is only mysql processing, but there is no postgresql processing.</p>
  
  <p>Sorry, give you more trouble, thank you in advance for your help.</p>