feat(Go-Tool):创建timed包相关时间操作工具,实现时间戳、时间格式化操作。创建timed测试类
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* @Author : huangzj
|
||||
* @Time : 2020/5/7 12:00
|
||||
* @Description: 时间比较工具
|
||||
*/
|
||||
|
||||
package timed
|
||||
|
||||
func IsBefore(timestamp, compareStamp int64) bool {
|
||||
return timestamp < compareStamp
|
||||
}
|
||||
|
||||
func IsAfter(timestamp, compareStamp int64) bool {
|
||||
return timestamp > compareStamp
|
||||
}
|
||||
|
||||
func IsSameTime(timestamp, compareStamp int64) bool {
|
||||
return timestamp == compareStamp
|
||||
}
|
||||
|
||||
func IsDiffTime(timestamp, compareStamp int64) bool {
|
||||
return !IsSameTime(timestamp, compareStamp)
|
||||
}
|
||||
|
||||
func IsBetween(timeStamp, compareBefore, compareAfter int64) bool {
|
||||
return timeStamp >= compareBefore && timeStamp <= compareAfter
|
||||
}
|
||||
Reference in New Issue
Block a user