Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
b50bb0c9
Commit
b50bb0c9
authored
Feb 27, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正邮箱日志显示的执行时间不正确BUG
parent
c5120beb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
TimeFormatUtil.java
...dmin-core/src/main/java/com/byit/util/TimeFormatUtil.java
+28
-16
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/util/TimeFormatUtil.java
View file @
b50bb0c9
...
@@ -13,23 +13,35 @@ public class TimeFormatUtil {
...
@@ -13,23 +13,35 @@ public class TimeFormatUtil {
* @return
* @return
*/
*/
public
static
String
timeFormat
(
long
time
)
{
public
static
String
timeFormat
(
long
time
)
{
//秒
StringBuffer
sb
=
new
StringBuffer
();
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
time
);
long
millis
=
1
;
long
minutes
=
TimeUnit
.
MILLISECONDS
.
toMinutes
(
time
);
long
seconds
=
1000
*
millis
;
long
hours
=
TimeUnit
.
MILLISECONDS
.
toHours
(
time
);
long
minutes
=
60
*
seconds
;
//小时
long
hours
=
60
*
minutes
;
if
(
hours
>
0
){
long
days
=
24
*
hours
;
return
hours
+
"小时"
;
if
(
time
/
days
>=
1
){
//分钟
sb
.
append
((
int
)(
time
/
days
)+
"天"
);
}
if
(
minutes
>
0
)
{
return
minutes
+
"分钟"
;
//秒
}
else
if
(
seconds
>
0
)
{
return
seconds
+
"秒"
;
//毫秒
}
else
{
return
time
+
"毫秒"
;
}
}
if
(
time
%
days
/
hours
>=
1
){
sb
.
append
((
int
)(
time
%
days
/
hours
)+
"小时"
);
}
}
if
(
time
%
days
%
hours
/
minutes
>=
1
){
sb
.
append
((
int
)(
time
%
days
%
hours
/
minutes
)+
"分钟"
);
}
if
(
time
%
days
%
hours
%
minutes
/
seconds
>=
1
){
sb
.
append
((
int
)(
time
%
days
%
hours
%
minutes
/
seconds
)+
"秒"
);
}
if
(
time
%
days
%
hours
%
minutes
%
seconds
/
millis
>=
1
){
sb
.
append
((
int
)(
time
%
days
%
hours
%
minutes
%
seconds
/
millis
)+
"毫秒"
);
}
return
sb
.
toString
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment