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
28cf2dc7
Commit
28cf2dc7
authored
Dec 20, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://key@gitlab.egolm.com/key/common.git
parents
b76aaa3b
c42a5e27
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
454 additions
and
431 deletions
+454
-431
DateUtil.java
src/main/java/com/egolm/common/DateUtil.java
+454
-431
No files found.
src/main/java/com/egolm/common/DateUtil.java
View file @
28cf2dc7
...
@@ -31,6 +31,8 @@ public class DateUtil {
...
@@ -31,6 +31,8 @@ public class DateUtil {
public
static
final
String
FMT_YYYYMMddHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
final
String
FMT_YYYYMMddHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
final
String
FMT_UTC_ALIYUN
=
"yyyy-MM-dd'T'HH:mm:ss'Z'"
;
public
static
final
String
FMT_UTC_ALIYUN
=
"yyyy-MM-dd'T'HH:mm:ss'Z'"
;
public
static
final
String
FMT_YYYY_MM
=
"yyyy/MM"
;
public
static
final
Long
SECOND
=
1000L
;
public
static
final
Long
SECOND
=
1000L
;
public
static
final
Long
MINUTE
=
1000L
*
60
;
public
static
final
Long
MINUTE
=
1000L
*
60
;
public
static
final
Long
HALF_HOUR
=
MINUTE
*
30
;
public
static
final
Long
HALF_HOUR
=
MINUTE
*
30
;
...
@@ -424,6 +426,27 @@ public class DateUtil {
...
@@ -424,6 +426,27 @@ public class DateUtil {
c
.
add
(
Calendar
.
MONTH
,
0
);
c
.
add
(
Calendar
.
MONTH
,
0
);
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
return
c
.
getTime
();
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
()
{
public
static
String
getTimeStamp
()
{
return
String
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
);
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