|
|
@ -20,8 +20,10 @@ import cn.escheduler.common.Constants; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
|
import java.time.Instant; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
@ -30,145 +32,182 @@ import java.util.Date; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DateUtils { |
|
|
|
public class DateUtils { |
|
|
|
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return get the formatted date string for the current time |
|
|
|
* <code>java.util.Date</code> to <code>java.time.LocalDateTime</code> |
|
|
|
*/ |
|
|
|
* use default zone |
|
|
|
public static String getCurrentTime() { |
|
|
|
* @param date |
|
|
|
return getCurrentTime(Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
* @return |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
private static LocalDateTime date2LocalDateTime(Date date) { |
|
|
|
/** |
|
|
|
return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); |
|
|
|
* @param format |
|
|
|
} |
|
|
|
* @return get the date string in the specified format of the current time |
|
|
|
|
|
|
|
*/ |
|
|
|
/** |
|
|
|
public static String getCurrentTime(String format) { |
|
|
|
* <code>java.time.LocalDateTime</code> to <code>java.util.Date</code> |
|
|
|
return new SimpleDateFormat(format).format(new Date()); |
|
|
|
* use default zone |
|
|
|
} |
|
|
|
* @param localDateTime |
|
|
|
|
|
|
|
* @return |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* @param date |
|
|
|
private static Date localDateTime2Date(LocalDateTime localDateTime) { |
|
|
|
* @param format e.g. yyyy-MM-dd HH:mm:ss |
|
|
|
Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); |
|
|
|
* @return get the formatted date string |
|
|
|
return Date.from(instant); |
|
|
|
*/ |
|
|
|
} |
|
|
|
public static String format(Date date, String format) { |
|
|
|
|
|
|
|
return new SimpleDateFormat(format).format(date); |
|
|
|
/** |
|
|
|
} |
|
|
|
* @return get the formatted date string for the current time |
|
|
|
|
|
|
|
*/ |
|
|
|
/** |
|
|
|
public static String getCurrentTime() { |
|
|
|
* @param date |
|
|
|
return getCurrentTime(Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
* @return convert time to yyyy-MM-dd HH:mm:ss format |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public static String dateToString(Date date){ |
|
|
|
/** |
|
|
|
return format(date,Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
* @param format |
|
|
|
} |
|
|
|
* @return get the date string in the specified format of the current time |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static String getCurrentTime(String format) { |
|
|
|
/** |
|
|
|
// return new SimpleDateFormat(format).format(new Date());
|
|
|
|
* @param date |
|
|
|
return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); |
|
|
|
* @return convert string to date and time |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public static Date parse(String date,String format){ |
|
|
|
/** |
|
|
|
try { |
|
|
|
* @param date |
|
|
|
return new SimpleDateFormat(format).parse(date); |
|
|
|
* @param format e.g. yyyy-MM-dd HH:mm:ss |
|
|
|
} catch (Exception e) { |
|
|
|
* @return get the formatted date string |
|
|
|
logger.error("error while parse date:" + date, e); |
|
|
|
*/ |
|
|
|
} |
|
|
|
public static String format(Date date, String format) { |
|
|
|
return null; |
|
|
|
// return new SimpleDateFormat(format).format(date);
|
|
|
|
} |
|
|
|
return format(date2LocalDateTime(date), format); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* convert date str to yyyy-MM-dd HH:mm:ss format |
|
|
|
/** |
|
|
|
* @param str |
|
|
|
* @param localDateTime |
|
|
|
* @return |
|
|
|
* @param format e.g. yyyy-MM-dd HH:mm:ss |
|
|
|
*/ |
|
|
|
* @return get the formatted date string |
|
|
|
public static Date stringToDate(String str){ |
|
|
|
*/ |
|
|
|
return parse(str,Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
public static String format(LocalDateTime localDateTime, String format) { |
|
|
|
} |
|
|
|
return localDateTime.format(DateTimeFormatter.ofPattern(format)); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* get seconds between two dates |
|
|
|
/** |
|
|
|
* |
|
|
|
* @param date |
|
|
|
* @param d1 |
|
|
|
* @return convert time to yyyy-MM-dd HH:mm:ss format |
|
|
|
* @param d2 |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static String dateToString(Date date) { |
|
|
|
*/ |
|
|
|
return format(date, Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
public static long differSec(Date d1, Date d2) { |
|
|
|
} |
|
|
|
return (long) Math.ceil(differMs(d1, d2) / 1000.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param date |
|
|
|
* get ms between two dates |
|
|
|
* @return convert string to date and time |
|
|
|
* |
|
|
|
*/ |
|
|
|
* @param d1 |
|
|
|
public static Date parse(String date, String format) { |
|
|
|
* @param d2 |
|
|
|
try { |
|
|
|
* @return |
|
|
|
// return new SimpleDateFormat(format).parse(date);
|
|
|
|
*/ |
|
|
|
LocalDateTime ldt = LocalDateTime.parse(date, DateTimeFormatter.ofPattern(format)); |
|
|
|
public static long differMs(Date d1, Date d2) { |
|
|
|
return localDateTime2Date(ldt); |
|
|
|
return Math.abs(d1.getTime() - d2.getTime()); |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
logger.error("error while parse date:" + date, e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
/** |
|
|
|
} |
|
|
|
* get hours between two dates |
|
|
|
|
|
|
|
* |
|
|
|
/** |
|
|
|
* @param d1 |
|
|
|
* convert date str to yyyy-MM-dd HH:mm:ss format |
|
|
|
* @param d2 |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @param str |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static long diffHours(Date d1, Date d2) { |
|
|
|
*/ |
|
|
|
return (long) Math.ceil(diffMin(d1, d2) / 60.0); |
|
|
|
public static Date stringToDate(String str) { |
|
|
|
} |
|
|
|
return parse(str, Constants.YYYY_MM_DD_HH_MM_SS); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* get minutes between two dates |
|
|
|
/** |
|
|
|
* |
|
|
|
* get seconds between two dates |
|
|
|
* @param d1 |
|
|
|
* |
|
|
|
* @param d2 |
|
|
|
* @param d1 |
|
|
|
* @return |
|
|
|
* @param d2 |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static long diffMin(Date d1, Date d2) { |
|
|
|
*/ |
|
|
|
return (long) Math.ceil(differSec(d1, d2) / 60.0); |
|
|
|
public static long differSec(Date d1, Date d2) { |
|
|
|
} |
|
|
|
return (long) Math.ceil(differMs(d1, d2) / 1000.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* get ms between two dates |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param d1 |
|
|
|
|
|
|
|
* @param d2 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static long differMs(Date d1, Date d2) { |
|
|
|
|
|
|
|
return Math.abs(d1.getTime() - d2.getTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* get hours between two dates |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param d1 |
|
|
|
|
|
|
|
* @param d2 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static long diffHours(Date d1, Date d2) { |
|
|
|
|
|
|
|
return (long) Math.ceil(diffMin(d1, d2) / 60.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* get minutes between two dates |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param d1 |
|
|
|
|
|
|
|
* @param d2 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static long diffMin(Date d1, Date d2) { |
|
|
|
|
|
|
|
return (long) Math.ceil(differSec(d1, d2) / 60.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* get the date of the specified date in the days before and after |
|
|
|
* get the date of the specified date in the days before and after |
|
|
|
* @param date |
|
|
|
* |
|
|
|
* @param day |
|
|
|
* @param date |
|
|
|
* @return |
|
|
|
* @param day |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static Date getSomeDay(Date date, int day) { |
|
|
|
*/ |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
public static Date getSomeDay(Date date, int day) { |
|
|
|
calendar.setTime(date); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.add(Calendar.DATE, day); |
|
|
|
calendar.setTime(date); |
|
|
|
return calendar.getTime(); |
|
|
|
calendar.add(Calendar.DATE, day); |
|
|
|
} |
|
|
|
return calendar.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* compare two dates |
|
|
|
* compare two dates |
|
|
|
* |
|
|
|
* |
|
|
|
* @param future |
|
|
|
* @param future |
|
|
|
* @param old |
|
|
|
* @param old |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static boolean compare(Date future, Date old) { |
|
|
|
public static boolean compare(Date future, Date old) { |
|
|
|
return future.getTime() > old.getTime(); |
|
|
|
return future.getTime() > old.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* convert schedule string to date |
|
|
|
* convert schedule string to date |
|
|
|
* @param schedule |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @param schedule |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static Date getScheduleDate(String schedule){ |
|
|
|
*/ |
|
|
|
return stringToDate(schedule); |
|
|
|
public static Date getScheduleDate(String schedule) { |
|
|
|
} |
|
|
|
return stringToDate(schedule); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* format time to readable |
|
|
|
* format time to readable |
|
|
|
* |
|
|
|
* |
|
|
|
* @param ms |
|
|
|
* @param ms |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -183,131 +222,135 @@ public class DateUtils { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get monday |
|
|
|
* get monday |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* note: Set the first day of the week to Monday, the default is Sunday |
|
|
|
* note: Set the first day of the week to Monday, the default is Sunday |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Date getMonday(Date date) { |
|
|
|
public static Date getMonday(Date date) { |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
cal.setTime(date); |
|
|
|
cal.setTime(date); |
|
|
|
|
|
|
|
|
|
|
|
cal.setFirstDayOfWeek(Calendar.MONDAY); |
|
|
|
cal.setFirstDayOfWeek(Calendar.MONDAY); |
|
|
|
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); |
|
|
|
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); |
|
|
|
|
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
return cal.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get sunday |
|
|
|
* get sunday |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* note: Set the first day of the week to Monday, the default is Sunday |
|
|
|
* note: Set the first day of the week to Monday, the default is Sunday |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Date getSunday(Date date) { |
|
|
|
public static Date getSunday(Date date) { |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
cal.setTime(date); |
|
|
|
cal.setTime(date); |
|
|
|
|
|
|
|
|
|
|
|
cal.setFirstDayOfWeek(Calendar.MONDAY); |
|
|
|
cal.setFirstDayOfWeek(Calendar.MONDAY); |
|
|
|
cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); |
|
|
|
cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); |
|
|
|
|
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
return cal.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get first day of month |
|
|
|
* get first day of month |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Date getFirstDayOfMonth(Date date) { |
|
|
|
public static Date getFirstDayOfMonth(Date date) { |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
cal.setTime(date); |
|
|
|
cal.setTime(date); |
|
|
|
cal.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
cal.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
return cal.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get first day of month |
|
|
|
* get first day of month |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Date getSomeHourOfDay(Date date, int hours) { |
|
|
|
public static Date getSomeHourOfDay(Date date, int hours) { |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
cal.setTime(date); |
|
|
|
cal.setTime(date); |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - hours); |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - hours); |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
|
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
return cal.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get last day of month |
|
|
|
* get last day of month |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Date getLastDayOfMonth(Date date) { |
|
|
|
public static Date getLastDayOfMonth(Date date) { |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
cal.setTime(date); |
|
|
|
cal.setTime(date); |
|
|
|
|
|
|
|
|
|
|
|
cal.add(Calendar.MONTH, 1); |
|
|
|
cal.add(Calendar.MONTH, 1); |
|
|
|
cal.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
cal.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
cal.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
cal.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
|
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
return cal.getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* return YYYY-MM-DD 00:00:00 |
|
|
|
* return YYYY-MM-DD 00:00:00 |
|
|
|
* @param inputDay |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @param inputDay |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
public static Date getStartOfDay(Date inputDay){ |
|
|
|
*/ |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
public static Date getStartOfDay(Date inputDay) { |
|
|
|
cal.setTime(inputDay); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
cal.setTime(inputDay); |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
return cal.getTime(); |
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
} |
|
|
|
return cal.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* return YYYY-MM-DD 23:59:59 |
|
|
|
/** |
|
|
|
* @param inputDay |
|
|
|
* return YYYY-MM-DD 23:59:59 |
|
|
|
* @return |
|
|
|
* |
|
|
|
*/ |
|
|
|
* @param inputDay |
|
|
|
public static Date getEndOfDay(Date inputDay){ |
|
|
|
* @return |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
*/ |
|
|
|
cal.setTime(inputDay); |
|
|
|
public static Date getEndOfDay(Date inputDay) { |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
cal.set(Calendar.MINUTE, 59); |
|
|
|
cal.setTime(inputDay); |
|
|
|
cal.set(Calendar.SECOND, 59); |
|
|
|
cal.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
return cal.getTime(); |
|
|
|
cal.set(Calendar.MINUTE, 59); |
|
|
|
} |
|
|
|
cal.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
/** |
|
|
|
} |
|
|
|
* return YYYY-MM-DD 00:00:00 |
|
|
|
|
|
|
|
* @param inputDay |
|
|
|
/** |
|
|
|
* @return |
|
|
|
* return YYYY-MM-DD 00:00:00 |
|
|
|
*/ |
|
|
|
* |
|
|
|
public static Date getStartOfHour(Date inputDay){ |
|
|
|
* @param inputDay |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
* @return |
|
|
|
cal.setTime(inputDay); |
|
|
|
*/ |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
public static Date getStartOfHour(Date inputDay) { |
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
return cal.getTime(); |
|
|
|
cal.setTime(inputDay); |
|
|
|
} |
|
|
|
cal.set(Calendar.MINUTE, 0); |
|
|
|
|
|
|
|
cal.set(Calendar.SECOND, 0); |
|
|
|
/** |
|
|
|
return cal.getTime(); |
|
|
|
* return YYYY-MM-DD 23:59:59 |
|
|
|
} |
|
|
|
* @param inputDay |
|
|
|
|
|
|
|
* @return |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* return YYYY-MM-DD 23:59:59 |
|
|
|
public static Date getEndOfHour(Date inputDay){ |
|
|
|
* |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
* @param inputDay |
|
|
|
cal.setTime(inputDay); |
|
|
|
* @return |
|
|
|
cal.set(Calendar.MINUTE, 59); |
|
|
|
*/ |
|
|
|
cal.set(Calendar.SECOND, 59); |
|
|
|
public static Date getEndOfHour(Date inputDay) { |
|
|
|
return cal.getTime(); |
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
} |
|
|
|
cal.setTime(inputDay); |
|
|
|
|
|
|
|
cal.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
cal.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
return cal.getTime(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|