aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2012-11-04 16:06:42 -0800
committermattn <mattn.jp@gmail.com>2012-11-04 16:06:42 -0800
commit68952ca0661526d253d3a9e7551d0612b357bd2b (patch)
tree46a47f5d8f6be8abf441663320ce7cec96a8730b /sqlite3.go
parentMerge pull request #26 from cookieo9/noexample (diff)
parentAdd support for extracting 2006-01-02 formatted timestamps. (diff)
downloadgolite-68952ca0661526d253d3a9e7551d0612b357bd2b.tar.gz
golite-68952ca0661526d253d3a9e7551d0612b357bd2b.tar.xz
Merge pull request #28 from lye/master
Add support for extracting 2006-01-02 formatted timestamps.
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 270403d..90a1241 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -27,6 +27,7 @@ import (
)
const SQLiteTimestampFormat = "2006-01-02 15:04:05"
+const SQLiteDateFormat = "2006-01-02"
func init() {
sql.Register("sqlite3", &SQLiteDriver{})
@@ -313,7 +314,10 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
if rc.decltype[i] == "timestamp" {
dest[i], err = time.Parse(SQLiteTimestampFormat, s)
if err != nil {
- return err
+ dest[i], err = time.Parse(SQLiteDateFormat, s)
+ if err != nil {
+ return err
+ }
}
} else {
dest[i] = s