org.joda.time.LocalDate#toDate ( )源码实例Demo

下面列出了org.joda.time.LocalDate#toDate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Almost-Famous   文件: DateUtils.java
/**
 * 根据周数,获取开始日期、结束日期
 *
 * @param week 周期  0本周,-1上周,-2上上周,1下周,2下下周
 * @return 返回date[0]开始日期、date[1]结束日期
 */
public static Date[] getWeekStartAndEnd(int week) {
    DateTime dateTime = new DateTime();
    LocalDate date = new LocalDate(dateTime.plusWeeks(week));

    date = date.dayOfWeek().withMinimumValue();
    Date beginDate = date.toDate();
    Date endDate = date.plusDays(6).toDate();
    return new Date[]{beginDate, endDate};
}
 
源代码2 项目: activiti6-boot2   文件: DateUtil.java
public static Date toDate(String dateString) {

        if (StringUtils.isEmpty(dateString)) {
            throw new IllegalArgumentException("date string cannot be empty");
        }

        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd");
        LocalDate dateTime = dtf.parseLocalDate(dateString);

        return dateTime.toDate();
    }
 
源代码3 项目: sdb-mall   文件: DateUtils.java
/**
 * 根据周数,获取开始日期、结束日期
 * @param week  周期  0本周,-1上周,-2上上周,1下周,2下下周
 * @return  返回date[0]开始日期、date[1]结束日期
 */
public static Date[] getWeekStartAndEnd(int week) {
    DateTime dateTime = new DateTime();
    LocalDate date = new LocalDate(dateTime.plusWeeks(week));

    date = date.dayOfWeek().withMinimumValue();
    Date beginDate = date.toDate();
    Date endDate = date.plusDays(6).toDate();
    return new Date[]{beginDate, endDate};
}
 
源代码4 项目: boot-actuator   文件: DateUtils.java
/**
 * 根据周数,获取开始日期、结束日期
 * @param week  周期  0本周,-1上周,-2上上周,1下周,2下下周
 * @return  返回date[0]开始日期、date[1]结束日期
 */
public static Date[] getWeekStartAndEnd(int week) {
    DateTime dateTime = new DateTime();
    LocalDate date = new LocalDate(dateTime.plusWeeks(week));

    date = date.dayOfWeek().withMinimumValue();
    Date beginDate = date.toDate();
    Date endDate = date.plusDays(6).toDate();
    return new Date[]{beginDate, endDate};
}
 
源代码5 项目: Knowage-Server   文件: SelfServiceDataSetCRUD.java
private boolean isADate(JSONObject jsonConf, IDataStore dataStore, int columnIndex) throws JSONException {
	String dateFormat = jsonConf.get(DataSetConstants.FILE_DATE_FORMAT).toString();
	for (int i = 0; i < Math.min(10, dataStore.getRecordsCount()); i++) {
		IRecord record = dataStore.getRecordAt(i);
		IField field = record.getFieldAt(columnIndex);
		Object value = field.getValue();
		if (value instanceof Date) {
			if (value instanceof Timestamp)
				return false;

			// it's already a Date, skip the check
			continue;
		}
		try {
			// JDK 8 version
			/*
			 * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat); LocalDate localDate = LocalDate.parse((String) field.getValue(),
			 * formatter); Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
			 */
			DateTimeFormatter formatter = DateTimeFormat.forPattern(dateFormat);
			LocalDate localDate = LocalDate.parse((String) field.getValue(), formatter);
			localDate.toDate();

		} catch (Exception ex) {
			logger.debug(field.getValue() + " is not a date");
			return false;
		}
	}
	return true;
}
 
源代码6 项目: flowable-engine   文件: DateUtil.java
public static Date toDate(Object dateString) {

        if (dateString == null) {
            throw new IllegalArgumentException("date string cannot be empty");
        }

        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd");
        LocalDate dateTime = dtf.parseLocalDate((String) dateString);

        return dateTime.toDate();
    }
 
源代码7 项目: commcare-android   文件: DateWidget.java
@Override
public IAnswerData getAnswer() {
    mDatePicker.clearFocus();

    LocalDate ldt = new LocalDate(mDatePicker.getYear(), mDatePicker.getMonth() + 1,
            mDatePicker.getDayOfMonth());
    return new DateData(ldt.toDate());
}
 
源代码8 项目: blog-spring   文件: LocalDateConverter.java
@Override
public Date convertToDatabaseColumn(LocalDate attribute) {
  return attribute == null ? null : attribute.toDate();
}
 
@Override
public Date convert(LocalDate in, Context context) throws Exception {
    if (in == null) return null;
    return in.toDate();
}
 
源代码10 项目: activiti6-boot2   文件: DateUtil.java
public static Date addDate(Date startDate, Integer years, Integer months, Integer days) {

        LocalDate currentDate = new LocalDate(startDate);

        currentDate = currentDate.plusYears(years);
        currentDate = currentDate.plusMonths(months);
        currentDate = currentDate.plusDays(days);

        return currentDate.toDate();
    }
 
源代码11 项目: activiti6-boot2   文件: DateUtil.java
public static Date subtractDate(Date startDate, Integer years, Integer months, Integer days) {

        LocalDate currentDate = new LocalDate(startDate);

        currentDate = currentDate.minusYears(years);
        currentDate = currentDate.minusMonths(months);
        currentDate = currentDate.minusDays(days);

        return currentDate.toDate();
    }
 
源代码12 项目: flowable-engine   文件: DateUtil.java
public static Date addDate(Object startDate, Object years, Object months, Object days) {

        LocalDate currentDate = new LocalDate(startDate);
        
        currentDate = currentDate.plusYears(intValue(years));
        currentDate = currentDate.plusMonths(intValue(months));
        currentDate = currentDate.plusDays(intValue(days));

        return currentDate.toDate();
    }
 
源代码13 项目: flowable-engine   文件: DateUtil.java
public static Date subtractDate(Object startDate, Object years, Object months, Object days) {

        LocalDate currentDate = new LocalDate(startDate);

        currentDate = currentDate.minusYears(intValue(years));
        currentDate = currentDate.minusMonths(intValue(months));
        currentDate = currentDate.minusDays(intValue(days));

        return currentDate.toDate();
    }