Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
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
曲欣亮
common
Commits
a2463789
Commit
a2463789
authored
May 20, 2020
by
张永
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.linkfern.com/key/common.git
parents
33051cde
1da43d04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
DateUtil.java
src/main/java/com/egolm/common/DateUtil.java
+12
-3
No files found.
src/main/java/com/egolm/common/DateUtil.java
View file @
a2463789
...
...
@@ -254,17 +254,26 @@ public class DateUtil {
*/
public
static
String
format
(
Integer
time
,
String
fmt
)
{
if
(
time
!=
null
)
{
if
(
time
<
86400000
)
{
Integer
dayCount
=
0
;
while
(
time
>=
86400000
)
{
time
-=
86400000
;
dayCount
+=
1
;
}
if
(
dayCount
>
0
)
{
return
"大于"
+
dayCount
+
"天"
;
}
else
{
Date
date
=
new
Date
(
time
-
(
1000
*
60
*
60
*
8
));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
fmt
);
return
sdf
.
format
(
date
);
}
else
{
throw
new
RuntimeException
(
"Can't greater than 86400000"
);
}
}
else
{
return
null
;
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
format
(
Integer
.
MAX_VALUE
));
}
/**
* 计算指定时间当天的开始时间
...
...
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