Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
5a855d59
Commit
5a855d59
authored
Apr 13, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
不记录系统日志
parent
9df52bc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+12
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
5a855d59
...
...
@@ -246,6 +246,7 @@ public class DateHelper {
//当前起始日期
Calendar
begin
=
Calendar
.
getInstance
();
begin
.
set
(
c
.
get
(
Calendar
.
YEAR
),
c
.
get
(
Calendar
.
MONTH
),
c
.
get
(
Calendar
.
DAY_OF_MONTH
),
0
,
0
,
0
);
begin
.
set
(
Calendar
.
MILLISECOND
,
0
);
return
begin
;
}
...
...
@@ -256,6 +257,13 @@ public class DateHelper {
cal
.
set
(
Calendar
.
MILLISECOND
,
999
);
}
private
static
void
setDayStart
(
Calendar
cal
)
{
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
}
/**
* 获取某一天起始和结束时间
...
...
@@ -290,6 +298,7 @@ public class DateHelper {
public
static
Date
getMonthStart
(
Date
date
)
{
Calendar
cal
=
getDayCalendarBegin
(
date
);
cal
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
setDayStart
(
cal
);
return
cal
.
getTime
();
}
...
...
@@ -318,6 +327,7 @@ public class DateHelper {
int
month
=
cal
.
get
(
Calendar
.
MONTH
)
/
3
*
3
;
cal
.
set
(
Calendar
.
MONTH
,
month
);
cal
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
setDayStart
(
cal
);
return
cal
.
getTime
();
}
...
...
@@ -346,6 +356,7 @@ public class DateHelper {
Calendar
cal
=
getDayCalendarBegin
(
date
);
cal
.
set
(
Calendar
.
MONTH
,
0
);
cal
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
setDayStart
(
cal
);
return
cal
.
getTime
();
}
...
...
@@ -359,6 +370,7 @@ public class DateHelper {
Calendar
cal
=
getDayCalendarBegin
(
date
);
cal
.
set
(
Calendar
.
MONTH
,
11
);
cal
.
set
(
Calendar
.
DAY_OF_MONTH
,
31
);
setDayEnd
(
cal
);
return
cal
.
getTime
();
}
...
...
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