提交 396fcef3 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Allow [timeZoneName] part after time zone offset

上级 b4bd7750
......@@ -470,7 +470,12 @@ public class DateTimeUtils {
timeZoneStart = s.indexOf('-', dateEnd + 1);
}
if (timeZoneStart >= 0) {
String tzName = "GMT" + s.substring(timeZoneStart);
// Allow [timeZoneName] part after time zone offset
int offsetEnd = s.indexOf('[', timeZoneStart + 1);
if (offsetEnd < 0) {
offsetEnd = s.length();
}
String tzName = "GMT" + s.substring(timeZoneStart, offsetEnd);
tz = TimeZone.getTimeZone(tzName);
if (!tz.getID().startsWith(tzName)) {
throw new IllegalArgumentException(
......
......@@ -29,8 +29,9 @@ SELECT * FROM tab_with_timezone ORDER BY X;
SELECT TIMESTAMP WITH TIME ZONE '2000-01-10 00:00:00 -02' AS A,
TIMESTAMP WITH TIME ZONE '2000-01-10 00:00:00.000000000 +02:00' AS B,
TIMESTAMP WITH TIME ZONE '2000-01-10 00:00:00.000000000+02:00' AS C;
> A B C
> ------------------------ ------------------------ ------------------------
> 2000-01-10 00:00:00.0-02 2000-01-10 00:00:00.0+02 2000-01-10 00:00:00.0+02
TIMESTAMP WITH TIME ZONE '2000-01-10 00:00:00.000000000+02:00' AS C,
TIMESTAMP WITH TIME ZONE '2000-01-10T00:00:00.000000000+09:00[Asia/Tokyo]' AS D;
> A B C D
> ------------------------ ------------------------ ------------------------ ------------------------
> 2000-01-10 00:00:00.0-02 2000-01-10 00:00:00.0+02 2000-01-10 00:00:00.0+02 2000-01-10 00:00:00.0+09
> rows: 1
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论