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
3c65703d
Commit
3c65703d
authored
May 07, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消除成功接收处理
parent
6a9da843
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+16
-8
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
3c65703d
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
...
@@ -36,8 +35,8 @@ public class DateHelper {
...
@@ -36,8 +35,8 @@ public class DateHelper {
/**
/**
* 获取时间
* 获取时间
*
*
* @param from
* @param from
来源时间
* @return
* @return
结束时间
*/
*/
public
static
Date
getDateTime
(
Object
from
)
{
public
static
Date
getDateTime
(
Object
from
)
{
try
{
try
{
...
@@ -511,7 +510,7 @@ public class DateHelper {
...
@@ -511,7 +510,7 @@ public class DateHelper {
*
*
* @param format 格式 yyyy-MM-dd HH:mm:ss
* @param format 格式 yyyy-MM-dd HH:mm:ss
* @param date 字符串
* @param date 字符串
* @return
* @return
转换后的结果
*/
*/
public
static
String
getDateTimeString
(
String
format
,
Date
date
)
{
public
static
String
getDateTimeString
(
String
format
,
Date
date
)
{
String
to
=
""
;
String
to
=
""
;
...
@@ -525,8 +524,8 @@ public class DateHelper {
...
@@ -525,8 +524,8 @@ public class DateHelper {
* 比较时间
* 比较时间
*
*
* @param from 对比时间
* @param from 对比时间
* @param to
* @param to
结束时间
* @return
* @return
对别结果
*/
*/
public
static
int
compare
(
Date
from
,
Date
to
)
{
public
static
int
compare
(
Date
from
,
Date
to
)
{
if
(
from
==
null
&&
to
==
null
)
{
if
(
from
==
null
&&
to
==
null
)
{
...
@@ -569,12 +568,21 @@ public class DateHelper {
...
@@ -569,12 +568,21 @@ public class DateHelper {
* @param date 当前时间 yyyy-MM-dd HH:mm:ss
* @param date 当前时间 yyyy-MM-dd HH:mm:ss
* @param from 开始时间 00:00:00
* @param from 开始时间 00:00:00
* @param to 结束时间 00:05:00
* @param to 结束时间 00:05:00
* @return
* @return
是否在时间范围之内
*/
*/
public
static
boolean
isBetween
(
Date
date
,
String
from
,
String
to
)
{
public
static
boolean
isBetween
(
Date
date
,
String
from
,
String
to
)
{
if
(
date
==
null
)
{
return
false
;
}
Date
fromDate
=
getDateTime
(
getDateTimeString
(
FORMAT_DAY_STRING
+
" "
+
from
,
date
));
Date
fromDate
=
getDateTime
(
getDateTimeString
(
FORMAT_DAY_STRING
+
" "
+
from
,
date
));
Date
toDate
=
getDateTime
(
getDateTimeString
(
FORMAT_DAY_STRING
+
" "
+
to
,
date
));
Date
toDate
=
getDateTime
(
getDateTimeString
(
FORMAT_DAY_STRING
+
" "
+
to
,
date
));
return
date
.
getTime
()
>=
fromDate
.
getTime
()
&&
date
.
getTime
()
<=
toDate
.
getTime
();
if
(
fromDate
!=
null
&&
date
.
getTime
()
<
fromDate
.
getTime
())
{
return
false
;
}
if
(
toDate
!=
null
&&
date
.
getTime
()
>
toDate
.
getTime
())
{
return
false
;
}
return
true
;
}
}
/**
/**
...
...
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