Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
4d0e1f69
Commit
4d0e1f69
authored
Aug 26, 2022
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交truncDate,istarshine的依赖
parent
881e33a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
pom.xml
+5
-0
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
+41
-2
No files found.
pom.xml
View file @
4d0e1f69
...
@@ -232,6 +232,11 @@
...
@@ -232,6 +232,11 @@
<artifactId>
nlp-aggree
</artifactId>
<artifactId>
nlp-aggree
</artifactId>
<version>
0.0.5-SNAPSHOT
</version>
<version>
0.0.5-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.zhiwei.tools
</groupId>
<artifactId>
zhiwei-tools
</artifactId>
<version>
0.3.3-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
View file @
4d0e1f69
...
@@ -37,6 +37,7 @@ import java.nio.ByteBuffer;
...
@@ -37,6 +37,7 @@ import java.nio.ByteBuffer;
import
java.nio.channels.Channels
;
import
java.nio.channels.Channels
;
import
java.nio.channels.ReadableByteChannel
;
import
java.nio.channels.ReadableByteChannel
;
import
java.nio.channels.WritableByteChannel
;
import
java.nio.channels.WritableByteChannel
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -445,6 +446,44 @@ public class Tools {
...
@@ -445,6 +446,44 @@ public class Tools {
/**
/**
* 日期取整,去掉时分秒
* 日期取整,去掉时分秒
* @param time
* @param pattern
* @return
*/
public
static
Long
truncDate
(
Long
time
,
String
pattern
){
Long
result
=
null
;
if
(
time
!=
null
)
{
Date
date
=
new
Date
(
time
);
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
if
(!
pattern
.
contains
(
"yyyy"
))
{
c
.
set
(
Calendar
.
YEAR
,
1970
);
}
if
(!
pattern
.
contains
(
"MM"
))
{
c
.
set
(
Calendar
.
MONTH
,
0
);
}
if
(!
pattern
.
contains
(
"dd"
))
{
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
}
if
(!
pattern
.
contains
(
"HH"
))
{
c
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
}
if
(!
pattern
.
contains
(
"mm"
))
{
c
.
set
(
Calendar
.
MINUTE
,
0
);
}
if
(!
pattern
.
contains
(
"ss"
))
{
c
.
set
(
Calendar
.
SECOND
,
0
);
}
if
(!
pattern
.
contains
(
"SSS"
))
{
c
.
set
(
Calendar
.
MILLISECOND
,
0
);
}
result
=
c
.
getTime
().
getTime
();
}
return
result
;
}
/**
* 日期取整,去掉时分秒
*
*
* @param date
* @param date
* @return Date
* @return Date
...
@@ -805,8 +844,8 @@ public class Tools {
...
@@ -805,8 +844,8 @@ public class Tools {
/**
/**
* 解析时间转换成按月基数时间的集合
* 解析时间转换成按月基数时间的集合
*
*
* @param start
Time
开始时间
* @param start
Long
开始时间
* @param end
Time
结束时间
* @param end
Long
结束时间
* @return 按月基数分割时间的集合
* @return 按月基数分割时间的集合
*/
*/
public
static
List
<
Map
<
String
,
Long
>>
parseToDaysWithBase
(
Long
startLong
,
Long
endLong
)
{
public
static
List
<
Map
<
String
,
Long
>>
parseToDaysWithBase
(
Long
startLong
,
Long
endLong
)
{
...
...
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