Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds-android
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
云深项目组
beyond-clouds-android
Commits
80e2f3f3
Commit
80e2f3f3
authored
Mar 19, 2020
by
张晋雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化时间工具
parent
ba280389
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
app/src/main/java/cn/yunliyunwai/beyondclouds/util/TimeUtils.java
+6
-6
No files found.
app/src/main/java/cn/yunliyunwai/beyondclouds/util/TimeUtils.java
View file @
80e2f3f3
...
@@ -26,7 +26,7 @@ public class TimeUtils {
...
@@ -26,7 +26,7 @@ public class TimeUtils {
int
yearDiff
=
now
.
get
(
Calendar
.
MONTH
)
-
input
.
get
(
Calendar
.
MONTH
);;
int
yearDiff
=
now
.
get
(
Calendar
.
YEAR
)
-
input
.
get
(
Calendar
.
YEAR
);;
int
monthDiff
=
now
.
get
(
Calendar
.
MONTH
)
-
input
.
get
(
Calendar
.
MONTH
);;
int
monthDiff
=
now
.
get
(
Calendar
.
MONTH
)
-
input
.
get
(
Calendar
.
MONTH
);;
int
dayDiff
=
now
.
get
(
Calendar
.
DAY_OF_MONTH
)
-
input
.
get
(
Calendar
.
DAY_OF_MONTH
);
int
dayDiff
=
now
.
get
(
Calendar
.
DAY_OF_MONTH
)
-
input
.
get
(
Calendar
.
DAY_OF_MONTH
);
int
hourDiff
=
now
.
get
(
Calendar
.
HOUR
)
-
input
.
get
(
Calendar
.
HOUR
);
int
hourDiff
=
now
.
get
(
Calendar
.
HOUR
)
-
input
.
get
(
Calendar
.
HOUR
);
...
@@ -40,16 +40,16 @@ public class TimeUtils {
...
@@ -40,16 +40,16 @@ public class TimeUtils {
if
(
yearDiff
!=
0
)
{
if
(
yearDiff
!=
0
)
{
number
=
Math
.
abs
(
yearDiff
);
number
=
Math
.
abs
(
yearDiff
);
prefix
=
PREFIX_YEAR
;
prefix
=
PREFIX_YEAR
;
suffix
=
yearDiff
>
0
?
SUFFIX_
AFTER
:
SUFFIX_BEFORE
;
suffix
=
yearDiff
>
0
?
SUFFIX_
BEFORE
:
SUFFIX_AFTER
;
}
else
if
(
monthDiff
!=
0
)
{
}
else
if
(
monthDiff
!=
0
)
{
number
=
Math
.
abs
(
monthDiff
);
number
=
Math
.
abs
(
monthDiff
);
prefix
=
PREFIX_MONTH
;
prefix
=
PREFIX_MONTH
;
suffix
=
monthDiff
>
0
?
SUFFIX_
AFTER
:
SUFFIX_BEFORE
;
suffix
=
monthDiff
>
0
?
SUFFIX_
BEFORE
:
SUFFIX_AFTER
;
}
else
if
(
dayDiff
!=
0
)
{
}
else
if
(
dayDiff
!=
0
)
{
number
=
Math
.
abs
(
dayDiff
);
number
=
Math
.
abs
(
dayDiff
);
prefix
=
PREFIX_DAY
;
prefix
=
PREFIX_DAY
;
suffix
=
dayDiff
>
0
?
SUFFIX_
AFTER
:
SUFFIX_BEFORE
;
suffix
=
dayDiff
>
0
?
SUFFIX_
BEFORE
:
SUFFIX_AFTER
;
}
else
if
(
hourDiff
!=
0
)
{
}
else
if
(
hourDiff
!=
0
)
{
number
=
Math
.
abs
(
hourDiff
);
number
=
Math
.
abs
(
hourDiff
);
...
@@ -59,12 +59,12 @@ public class TimeUtils {
...
@@ -59,12 +59,12 @@ public class TimeUtils {
}
else
if
(
minuteDiff
!=
0
)
{
}
else
if
(
minuteDiff
!=
0
)
{
number
=
Math
.
abs
(
minuteDiff
);
number
=
Math
.
abs
(
minuteDiff
);
prefix
=
PREFIX_MINUTE
;
prefix
=
PREFIX_MINUTE
;
suffix
=
monthDiff
>
0
?
SUFFIX_
AFTER
:
SUFFIX_BEFORE
;
suffix
=
monthDiff
>
0
?
SUFFIX_
BEFORE
:
SUFFIX_AFTER
;
}
else
if
(
secondDiff
!=
0
)
{
}
else
if
(
secondDiff
!=
0
)
{
number
=
Math
.
abs
(
secondDiff
);
number
=
Math
.
abs
(
secondDiff
);
prefix
=
PREFIX_SECOND
;
prefix
=
PREFIX_SECOND
;
suffix
=
secondDiff
>
0
?
SUFFIX_
AFTER
:
SUFFIX_BEFORE
;
suffix
=
secondDiff
>
0
?
SUFFIX_
BEFORE
:
SUFFIX_AFTER
;
}
else
{
}
else
{
number
=
0
;
number
=
0
;
...
...
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