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
86aaa505
Commit
86aaa505
authored
Jan 13, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【插件测试】脚本执行插件测试
parent
58742675
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
TimeFormatUtil.java
...dmin-core/src/main/java/com/byit/util/TimeFormatUtil.java
+35
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/util/TimeFormatUtil.java
0 → 100644
View file @
86aaa505
package
com
.
byit
.
util
;
import
java.util.concurrent.TimeUnit
;
/**
* 对于时间的格式化
* @author huangfu
*/
public
class
TimeFormatUtil
{
/**
* 格式化毫秒数 返回对应的时间单位
* @param time
* @return
*/
public
static
String
timeFormat
(
long
time
)
{
//秒
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
time
);
long
minutes
=
TimeUnit
.
MILLISECONDS
.
toMinutes
(
time
);
long
hours
=
TimeUnit
.
MILLISECONDS
.
toHours
(
time
);
//小时
if
(
hours
>
0
){
return
hours
+
"小时"
;
//分钟
}
if
(
minutes
>
0
)
{
return
minutes
+
"分钟"
;
//秒
}
else
if
(
seconds
>
0
)
{
return
seconds
+
"秒"
;
//毫秒
}
else
{
return
time
+
"毫秒"
;
}
}
}
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