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

The following examples show how to use org.apache.commons.lang3.time.DateUtils#setMilliseconds() . 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: RowContext.java    From excel-rw-annotation with Apache License 2.0 5 votes vote down vote up
/**
 * 写date
 * 2016/12/09增加判空
 *
 * @param date  日期
 * @param style 样式
 */
private RowContext writeDate(Date date, CellStyle style) {

    if (date == null) {
        writeText("", style);
        return this;
    }
    //修正15:27:59.583中的583毫秒进位问题(将毫秒至为000)
    Date result = DateUtils.setMilliseconds(date, 0);
    createCell(1, style).setCellValue(result);
    return this;
}
 
Example 2
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 设置毫秒.
 */
public static Date setMilliseconds(@NotNull final Date date, int amount) {
	return DateUtils.setMilliseconds(date, amount);
}
 
Example 3
Source File: DateUtil.java    From vjtools with Apache License 2.0 4 votes vote down vote up
/**
 * 设置毫秒.
 */
public static Date setMilliseconds(@NotNull final Date date, int amount) {
	return DateUtils.setMilliseconds(date, amount);
}
 
Example 4
Source File: DateUtil.java    From j360-dubbo-app-all with Apache License 2.0 4 votes vote down vote up
/**
 * 设置毫秒.
 */
public static Date setMilliseconds(@NotNull final Date date, int amount) {
	return DateUtils.setMilliseconds(date, amount);
}
 
Example 5
Source File: TimePicker.java    From dsworkbench with Apache License 2.0 4 votes vote down vote up
public Date getTime() {
    Date d = new GregorianCalendar(0, 0, 0, pHour, pMinute).getTime();
    d = DateUtils.setSeconds(d, 0);
    d = DateUtils.setMilliseconds(d, 0);
    return d;
}
 
Example 6
Source File: HistoryCleanupTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
private Date getNextRunWithDelay(Date date, int countEmptyRuns) {
  //ignore milliseconds because MySQL does not support them, and it's not important for test
  return DateUtils.setMilliseconds(DateUtils.addSeconds(date, Math.min((int)(Math.pow(2., countEmptyRuns) * HistoryCleanupJobHandlerConfiguration.START_DELAY),
      HistoryCleanupJobHandlerConfiguration.MAX_DELAY)), 0);
}