Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
11af9ca4
提交
11af9ca4
authored
2月 14, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused assignments in ToChar.toCharDateTime()
上级
ea907544
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
36 行增加
和
36 行删除
+36
-36
ToChar.java
h2/src/main/org/h2/util/ToChar.java
+36
-36
没有找到文件。
h2/src/main/org/h2/util/ToChar.java
浏览文件 @
11af9ca4
...
@@ -663,20 +663,20 @@ public class ToChar {
...
@@ -663,20 +663,20 @@ public class ToChar {
// Long/short date/time format
// Long/short date/time format
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"DL"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"DL"
)
!=
null
)
{
String
day
=
getNames
(
WEEKDAYS
)[
DateTimeUtils
.
getSundayDayOfWeek
(
dateValue
)];
String
day
=
getNames
(
WEEKDAYS
)[
DateTimeUtils
.
getSundayDayOfWeek
(
dateValue
)];
String
month
=
getNames
(
MONTHS
)[
monthOfYear
-
1
];
String
month
=
getNames
(
MONTHS
)[
monthOfYear
-
1
];
output
.
append
(
day
).
append
(
", "
).
append
(
month
).
append
(
' '
).
append
(
dayOfMonth
).
append
(
", "
);
output
.
append
(
day
).
append
(
", "
).
append
(
month
).
append
(
' '
).
append
(
dayOfMonth
).
append
(
", "
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"DS"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"DS"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
monthOfYear
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
monthOfYear
);
output
.
append
(
'/'
);
output
.
append
(
'/'
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
dayOfMonth
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
dayOfMonth
);
output
.
append
(
'/'
);
output
.
append
(
'/'
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"TS"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"TS"
)
!=
null
)
{
output
.
append
(
h12
).
append
(
':'
);
output
.
append
(
h12
).
append
(
':'
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
minute
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
minute
);
output
.
append
(
':'
);
output
.
append
(
':'
);
...
@@ -687,10 +687,10 @@ public class ToChar {
...
@@ -687,10 +687,10 @@ public class ToChar {
// Day
// Day
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"DDD"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"DDD"
)
!=
null
)
{
output
.
append
(
DateTimeUtils
.
getDayOfYear
(
dateValue
));
output
.
append
(
DateTimeUtils
.
getDayOfYear
(
dateValue
));
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"DD"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"DD"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
dayOfMonth
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
dayOfMonth
);
i
+=
2
;
i
+=
2
;
}
else
if
((
cap
=
containsAt
(
format
,
i
,
"DY"
))
!=
null
)
{
}
else
if
((
cap
=
containsAt
(
format
,
i
,
"DY"
))
!=
null
)
{
...
@@ -704,60 +704,60 @@ public class ToChar {
...
@@ -704,60 +704,60 @@ public class ToChar {
}
}
output
.
append
(
cap
.
apply
(
day
));
output
.
append
(
cap
.
apply
(
day
));
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"D"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"D"
)
!=
null
)
{
output
.
append
(
DateTimeUtils
.
getSundayDayOfWeek
(
dateValue
));
output
.
append
(
DateTimeUtils
.
getSundayDayOfWeek
(
dateValue
));
i
+=
1
;
i
+=
1
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"J"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"J"
)
!=
null
)
{
output
.
append
(
DateTimeUtils
.
absoluteDayFromDateValue
(
dateValue
)
-
JULIAN_EPOCH
);
output
.
append
(
DateTimeUtils
.
absoluteDayFromDateValue
(
dateValue
)
-
JULIAN_EPOCH
);
i
+=
1
;
i
+=
1
;
// Hours
// Hours
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"HH24"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"HH24"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
hour
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
hour
);
i
+=
4
;
i
+=
4
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"HH12"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"HH12"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
h12
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
h12
);
i
+=
4
;
i
+=
4
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"HH"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"HH"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
h12
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
h12
);
i
+=
2
;
i
+=
2
;
// Minutes
// Minutes
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"MI"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"MI"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
minute
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
minute
);
i
+=
2
;
i
+=
2
;
// Seconds
// Seconds
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"SSSSS"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"SSSSS"
)
!=
null
)
{
int
seconds
=
(
int
)
(
timeNanos
/
1_000_000_000
);
int
seconds
=
(
int
)
(
timeNanos
/
1_000_000_000
);
output
.
append
(
seconds
);
output
.
append
(
seconds
);
i
+=
5
;
i
+=
5
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"SS"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"SS"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
second
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
second
);
i
+=
2
;
i
+=
2
;
// Fractional seconds
// Fractional seconds
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"FF1"
,
"FF2"
,
}
else
if
(
containsAt
(
format
,
i
,
"FF1"
,
"FF2"
,
"FF3"
,
"FF4"
,
"FF5"
,
"FF6"
,
"FF7"
,
"FF8"
,
"FF9"
)
)
!=
null
)
{
"FF3"
,
"FF4"
,
"FF5"
,
"FF6"
,
"FF7"
,
"FF8"
,
"FF9"
)
!=
null
)
{
int
x
=
format
.
charAt
(
i
+
2
)
-
'0'
;
int
x
=
format
.
charAt
(
i
+
2
)
-
'0'
;
int
ff
=
(
int
)
(
nanos
*
Math
.
pow
(
10
,
x
-
9
));
int
ff
=
(
int
)
(
nanos
*
Math
.
pow
(
10
,
x
-
9
));
StringUtils
.
appendZeroPadded
(
output
,
x
,
ff
);
StringUtils
.
appendZeroPadded
(
output
,
x
,
ff
);
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"FF"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"FF"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
9
,
nanos
);
StringUtils
.
appendZeroPadded
(
output
,
9
,
nanos
);
i
+=
2
;
i
+=
2
;
// Time zone
// Time zone
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"TZR"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"TZR"
)
!=
null
)
{
TimeZone
tz
=
TimeZone
.
getDefault
();
TimeZone
tz
=
TimeZone
.
getDefault
();
output
.
append
(
tz
.
getID
());
output
.
append
(
tz
.
getID
());
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"TZD"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"TZD"
)
!=
null
)
{
TimeZone
tz
=
TimeZone
.
getDefault
();
TimeZone
tz
=
TimeZone
.
getDefault
();
boolean
daylight
=
tz
.
inDaylightTime
(
new
java
.
util
.
Date
());
boolean
daylight
=
tz
.
inDaylightTime
(
new
java
.
util
.
Date
());
output
.
append
(
tz
.
getDisplayName
(
daylight
,
TimeZone
.
SHORT
));
output
.
append
(
tz
.
getDisplayName
(
daylight
,
TimeZone
.
SHORT
));
...
@@ -765,48 +765,48 @@ public class ToChar {
...
@@ -765,48 +765,48 @@ public class ToChar {
// Week
// Week
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"IW"
,
"WW"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"IW"
,
"WW"
)
!=
null
)
{
output
.
append
(
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
0
,
1
));
output
.
append
(
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
0
,
1
));
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"W"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"W"
)
!=
null
)
{
int
w
=
1
+
dayOfMonth
/
7
;
int
w
=
1
+
dayOfMonth
/
7
;
output
.
append
(
w
);
output
.
append
(
w
);
i
+=
1
;
i
+=
1
;
// Year
// Year
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"Y,YYY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"Y,YYY"
)
!=
null
)
{
output
.
append
(
new
DecimalFormat
(
"#,###"
).
format
(
posYear
));
output
.
append
(
new
DecimalFormat
(
"#,###"
).
format
(
posYear
));
i
+=
5
;
i
+=
5
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"SYYYY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"SYYYY"
)
!=
null
)
{
// Should be <= 0, but Oracle prints negative years with off-by-one difference
// Should be <= 0, but Oracle prints negative years with off-by-one difference
if
(
year
<
0
)
{
if
(
year
<
0
)
{
output
.
append
(
'-'
);
output
.
append
(
'-'
);
}
}
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
i
+=
5
;
i
+=
5
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"YYYY"
,
"RRRR"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"YYYY"
,
"RRRR"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
StringUtils
.
appendZeroPadded
(
output
,
4
,
posYear
);
i
+=
4
;
i
+=
4
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"IYYY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"IYYY"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
4
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
)));
StringUtils
.
appendZeroPadded
(
output
,
4
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
)));
i
+=
4
;
i
+=
4
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"YYY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"YYY"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
3
,
posYear
%
1000
);
StringUtils
.
appendZeroPadded
(
output
,
3
,
posYear
%
1000
);
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"IYY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"IYY"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
3
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
1000
);
StringUtils
.
appendZeroPadded
(
output
,
3
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
1000
);
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"YY"
,
"RR"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"YY"
,
"RR"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
posYear
%
100
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
posYear
%
100
);
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"IY"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"IY"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
100
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
100
);
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"Y"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"Y"
)
!=
null
)
{
output
.
append
(
posYear
%
10
);
output
.
append
(
posYear
%
10
);
i
+=
1
;
i
+=
1
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"I"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"I"
)
!=
null
)
{
output
.
append
(
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
10
);
output
.
append
(
Math
.
abs
(
DateTimeUtils
.
getIsoWeekYear
(
dateValue
))
%
10
);
i
+=
1
;
i
+=
1
;
...
@@ -823,35 +823,35 @@ public class ToChar {
...
@@ -823,35 +823,35 @@ public class ToChar {
String
month
=
getNames
(
SHORT_MONTHS
)[
monthOfYear
-
1
];
String
month
=
getNames
(
SHORT_MONTHS
)[
monthOfYear
-
1
];
output
.
append
(
cap
.
apply
(
month
));
output
.
append
(
cap
.
apply
(
month
));
i
+=
3
;
i
+=
3
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"MM"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"MM"
)
!=
null
)
{
StringUtils
.
appendZeroPadded
(
output
,
2
,
monthOfYear
);
StringUtils
.
appendZeroPadded
(
output
,
2
,
monthOfYear
);
i
+=
2
;
i
+=
2
;
}
else
if
((
cap
=
containsAt
(
format
,
i
,
"RM"
))
!=
null
)
{
}
else
if
((
cap
=
containsAt
(
format
,
i
,
"RM"
))
!=
null
)
{
output
.
append
(
cap
.
apply
(
toRomanNumeral
(
monthOfYear
)));
output
.
append
(
cap
.
apply
(
toRomanNumeral
(
monthOfYear
)));
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"Q"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"Q"
)
!=
null
)
{
int
q
=
1
+
((
monthOfYear
-
1
)
/
3
);
int
q
=
1
+
((
monthOfYear
-
1
)
/
3
);
output
.
append
(
q
);
output
.
append
(
q
);
i
+=
1
;
i
+=
1
;
// Local radix character
// Local radix character
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"X"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"X"
)
!=
null
)
{
char
c
=
DecimalFormatSymbols
.
getInstance
().
getDecimalSeparator
();
char
c
=
DecimalFormatSymbols
.
getInstance
().
getDecimalSeparator
();
output
.
append
(
c
);
output
.
append
(
c
);
i
+=
1
;
i
+=
1
;
// Format modifiers
// Format modifiers
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"FM"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"FM"
)
!=
null
)
{
fillMode
=
!
fillMode
;
fillMode
=
!
fillMode
;
i
+=
2
;
i
+=
2
;
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"FX"
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"FX"
)
!=
null
)
{
i
+=
2
;
i
+=
2
;
// Literal text
// Literal text
}
else
if
(
(
cap
=
containsAt
(
format
,
i
,
"\""
)
)
!=
null
)
{
}
else
if
(
containsAt
(
format
,
i
,
"\""
)
!=
null
)
{
for
(
i
=
i
+
1
;
i
<
format
.
length
();
i
++)
{
for
(
i
=
i
+
1
;
i
<
format
.
length
();
i
++)
{
char
c
=
format
.
charAt
(
i
);
char
c
=
format
.
charAt
(
i
);
if
(
c
!=
'"'
)
{
if
(
c
!=
'"'
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论