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
1da43d04
Commit
1da43d04
authored
May 18, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
a80a68f1
Show 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 @
1da43d04
...
@@ -254,18 +254,27 @@ public class DateUtil {
...
@@ -254,18 +254,27 @@ public class DateUtil {
*/
*/
public
static
String
format
(
Integer
time
,
String
fmt
)
{
public
static
String
format
(
Integer
time
,
String
fmt
)
{
if
(
time
!=
null
)
{
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
));
Date
date
=
new
Date
(
time
-
(
1000
*
60
*
60
*
8
));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
fmt
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
fmt
);
return
sdf
.
format
(
date
);
return
sdf
.
format
(
date
);
}
else
{
throw
new
RuntimeException
(
"Can't greater than 86400000"
);
}
}
}
else
{
}
else
{
return
null
;
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