Java Code Examples for org.apache.commons.lang3.time.DateUtils#ceiling()

The following examples show how to use org.apache.commons.lang3.time.DateUtils#ceiling() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchUtils.java    From jvue-admin with MIT License 5 votes vote down vote up
/**
 * 查询终止日期
 * @param date 日期("yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss")
 * @return 日期(次日0时0分)
 * @since  1.0
 */
public static Date dayTo(String date) {
    if (StringUtils.isEmpty(date)) {
        return null;
    }
    try {
        Date d = DateUtils.parseDate(date, PARSE_PATTERNS);
        return DateUtils.ceiling(d, Calendar.DATE);
    } catch (ParseException e) {
        LOGGER.warn("日期转换错误{},{}", date, e.getMessage());
    }
    return null;
}
 
Example 2
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-11-11 00:00:00
 */
public static Date nextDate(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.DATE);
}
 
Example 3
Source File: DateTimeUtils.java    From x-pipe with Apache License 2.0 4 votes vote down vote up
public static Date getNearestHour() {
	return DateUtils.ceiling(new Date(), Calendar.HOUR);
}
 
Example 4
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 07:34:00
 */
public static Date nextMinute(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MINUTE);
}
 
Example 5
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 08:00:00
 */
public static Date nextHour(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.HOUR_OF_DAY);
}
 
Example 6
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-11-11 00:00:00
 */
public static Date nextDate(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.DATE);
}
 
Example 7
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-12-1 00:00:00
 */
public static Date nextMonth(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MONTH);
}
 
Example 8
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2017-1-1 00:00:00
 */
public static Date nextYear(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.YEAR);
}
 
Example 9
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 07:34:00
 */
public static Date nextMinute(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MINUTE);
}
 
Example 10
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 08:00:00
 */
public static Date nextHour(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.HOUR_OF_DAY);
}
 
Example 11
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-12-1 00:00:00
 */
public static Date nextMonth(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MONTH);
}
 
Example 12
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2017-1-1 00:00:00
 */
public static Date nextYear(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.YEAR);
}
 
Example 13
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 07:34:00
 */
public static Date nextMinute(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MINUTE);
}
 
Example 14
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-12-10 07:33:23, 则返回2016-12-10 08:00:00
 */
public static Date nextHour(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.HOUR_OF_DAY);
}
 
Example 15
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-11-11 00:00:00
 */
public static Date nextDate(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.DATE);
}
 
Example 16
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2016-12-1 00:00:00
 */
public static Date nextMonth(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.MONTH);
}
 
Example 17
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 2016-11-10 07:33:23, 则返回2017-1-1 00:00:00
 */
public static Date nextYear(@NotNull final Date date) {
	return DateUtils.ceiling(date, Calendar.YEAR);
}