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
c42a5e27
Commit
c42a5e27
authored
Dec 15, 2018
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update DateUtil.java
parent
6cb16bb0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
DateUtil.java
src/main/java/com/egolm/common/DateUtil.java
+21
-0
No files found.
src/main/java/com/egolm/common/DateUtil.java
View file @
c42a5e27
...
...
@@ -427,6 +427,27 @@ public class DateUtil {
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
return
c
.
getTime
();
}
/**
* 获取指定日期下个月的第一天 的日期
* @param dateStr
* @param format
* @return
*/
public
static
String
getFirstDayOfNextMonth
(
String
dateStr
,
String
format
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
format
);
try
{
Date
date
=
sdf
.
parse
(
dateStr
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
add
(
Calendar
.
MONTH
,
1
);
return
sdf
.
format
(
calendar
.
getTime
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
String
getTimeStamp
()
{
return
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
}
...
...
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