提交 6282c593 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #469 from andreitokar/Issue#458

Fixes h2database/h2database#458 TIMESTAMPDIFF()
......@@ -1880,9 +1880,12 @@ public class Function extends Expression implements FunctionCall {
default:
break;
}
calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
// calendar.setTime(d1);
calendar.setTimeInMillis(t1);
int year1 = calendar.get(Calendar.YEAR);
int month1 = calendar.get(Calendar.MONTH);
// calendar.setTime(d2);
calendar.setTimeInMillis(t2);
int year2 = calendar.get(Calendar.YEAR);
int month2 = calendar.get(Calendar.MONTH);
......
......@@ -174,6 +174,10 @@ select timestampdiff(month, '2003-02-01','2003-05-01');
> 3;
select timestampdiff(YEAR,'2002-05-01','2001-01-01');
> -1;
select timestampdiff(YEAR,'2017-01-01','2016-12-31 23:59:59');
> -1;
select timestampdiff(YEAR,'2017-01-01','2017-12-31 23:59:59');
> 0;
select timestampdiff(MINUTE,'2003-02-01','2003-05-01 12:05:55');
> 128885;
select x from (select *, rownum as r from system_range(1, 3)) where r=2;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论