Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Support date_format #1295

Merged
merged 4 commits into from
Jun 6, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
evaluator: address comments
  • Loading branch information
zimulala committed Jun 6, 2016
commit 312a67a1af15fd945a7b5294bc1426b8bf87e9db
2 changes: 2 additions & 0 deletions evaluator/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ func convertDateFormat(arg types.Datum, b byte) (types.Datum, error) {
str := fmt.Sprintf("%04d", d.GetInt64())
d.SetString(fmt.Sprintf("%02s", str[2:]))
}
default:
d.SetString(string(b))
}

if err == nil && d.Kind() != types.KindNull {
Expand Down
4 changes: 2 additions & 2 deletions evaluator/builtin_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ func (s *testEvaluatorSuite) TestDateFormat(c *C) {
"%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %v %x %Y %y %%"},
"Jan January 01 1 1st 01 1 001 0 12 00 AM 12:00:00 AM 00:00:00 00 123456 52 4294967295 0000 00 %"},
{[]string{"2016-09-3 00:59:59.123456",
"abc%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U %u %V %v %a %W %w %X %x %Y %y!123 %%xyz"},
"abcSep September 09 9 3rd 03 3 247 0 12 59 AM 12:59:59 AM 00:59:59 59 123456 35 35 35 35 Sat Saturday 6 2016 2016 2016 16!123 %xyz"},
"abc%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U %u %V %v %a %W %w %X %x %Y %y!123 %%xyz %z"},
"abcSep September 09 9 3rd 03 3 247 0 12 59 AM 12:59:59 AM 00:59:59 59 123456 35 35 35 35 Sat Saturday 6 2016 2016 2016 16!123 %xyz z"},
}
dtblDate := tblToDtbl(tblDate)

Expand Down