Skip to content

Commit

Permalink
types: fix date time parse (#7933)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingwl authored and ngaut committed Oct 18, 2018
1 parent ba47280 commit a2beedf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions types/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ func parseDatetime(sc *stmtctx.StatementContext, str string, fsp int, isFloat bo
case 3:
// YYYY-MM-DD
err = scanTimeArgs(seps, &year, &month, &day)
case 4:
// YYYY-MM-DD HH
err = scanTimeArgs(seps, &year, &month, &day, &hour)
case 5:
// YYYY-MM-DD HH-MM
err = scanTimeArgs(seps, &year, &month, &day, &hour, &minute)
Expand Down
2 changes: 2 additions & 0 deletions types/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func (s *testTimeSuite) TestDateTime(c *C) {
{"170102036", "2017-01-02 03:06:00"},
{"170102039.", "2017-01-02 03:09:00"},
{"170102037.11", "2017-01-02 03:07:11.00"},
{"2018-01-01 18", "2018-01-01 18:00:00"},
{"18-01-01 18", "2018-01-01 18:00:00"},
}

for _, test := range table {
Expand Down

0 comments on commit a2beedf

Please sign in to comment.