本文整理了Java中org.motechproject.commons.date.util.DateUtil
类的一些代码示例,展示了DateUtil
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil
类的具体详情如下:
包路径:org.motechproject.commons.date.util.DateUtil
类名称:DateUtil
暂无
代码示例来源:origin: org.motechproject/motech-ivr-api
public CallDetailRecord(String callId, String phoneNumber) {
this.callId = callId;
this.phoneNumber = phoneNumber;
this.startDate = now();
}
代码示例来源:origin: org.motechproject/motech-ivr-api
@Override
public DateTime getStartDate() {
return setTimeZoneUTC(startDate);
}
代码示例来源:origin: org.motechproject/motech-ivr-api
public Date getAnswerDate() {
return answerDate != null ? setTimeZoneUTC(newDateTime(answerDate)).toDate() : answerDate;
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static DateTime nowUTC() {
return setTimeZoneUTC(now());
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static DateTime newDateTime(int year, int month, int day, int hour, int minute, int second) {
return newDateTime(newDate(year, month, day), hour, minute, second);
}
代码示例来源:origin: org.motechproject/motech-scheduler
private Trigger buildJobDetail(RepeatingSchedulableJob repeatingSchedulableJob, Date jobStartTime, Date jobEndTime, JobId jobId, JobDetail jobDetail, ScheduleBuilder scheduleBuilder) {
Trigger trigger = newTrigger()
.withIdentity(triggerKey(jobId.value(), JOB_GROUP_NAME))
.forJob(jobDetail)
.withSchedule(scheduleBuilder)
.startAt(jobStartTime)
.endAt(jobEndTime)
.build();
DateTime now = now();
if (repeatingSchedulableJob.isIgnorePastFiresAtStart() && newDateTime(jobStartTime).isBefore(now)) {
List<Date> pastTriggers = TriggerUtils.computeFireTimesBetween((OperableTrigger) trigger, null, jobStartTime, now.toDate());
if (pastTriggers.size() > 0) {
if (scheduleBuilder instanceof SimpleScheduleBuilder && repeatingSchedulableJob.getRepeatCount() != null) {
((SimpleScheduleBuilder) scheduleBuilder).withRepeatCount(repeatingSchedulableJob.getRepeatCount() - pastTriggers.size());
}
Date newStartTime = getFirstTriggerInFuture(trigger, now);
trigger = newTrigger()
.withIdentity(triggerKey(jobId.value(), JOB_GROUP_NAME))
.forJob(jobDetail)
.withSchedule(scheduleBuilder)
.startAt(newStartTime)
.endAt(jobEndTime)
.build();
}
}
return trigger;
}
代码示例来源:origin: org.motechproject/motech-pillreminder-api
@JsonIgnore
public boolean isTodaysDosageResponseCaptured() {
LocalDate today = DateUtil.today();
LocalDate yesterday = today.minusDays(1);
LocalTime localNow = DateUtil.now().toLocalTime();
if (responseLastCapturedDate == null) {
return false;
}
if (responseLastCapturedDate.equals(today)) {
return true;
}
return responseLastCapturedDate.equals(yesterday) && new Time(localNow.getHourOfDay(), localNow.getMinuteOfHour()).isBefore(dosageTime);
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static DateTime newDateTime(LocalDate date) {
return newDateTime(date, 0, 0, 0);
}
代码示例来源:origin: org.motechproject/motech-decisiontree-server
public Date getAnswerDate() {
return answerDate != null ? setTimeZone(newDateTime(answerDate)).toDate() : answerDate;
}
代码示例来源:origin: org.motechproject/motech-decisiontree-server
@Override
public DateTime getStartDate() {
return startDate != null ? setTimeZone(startDate) : startDate;
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static int getDifferenceOfDatesInYears(Date startDate) {
Period period = new Period(newDate(startDate), today(), PeriodType.yearMonthDay());
return period.getYears();
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static LocalDate tomorrow() {
return today().plusDays(1);
}
代码示例来源:origin: org.motechproject/motech-pillreminder-api
protected CronSchedulableJob getSchedulableDailyJob(PillRegimen pillRegimen, Dosage dosage) {
Map<String, Object> eventParams = new SchedulerPayloadBuilder()
.withJobId(dosage.getId())
.withDosageId(dosage.getId())
.withExternalId(pillRegimen.getExternalId())
.payload();
final Time dosageTime = dosage.getDosageTime();
DateTime cronStartDateTime = DateUtil.newDateTime(dosage.getStartDate(), dosageTime.getHour(), dosageTime.getMinute(), 0);
DateTime adjustedCronStartDateTime = cronStartDateTime.plusMinutes(pillRegimen.getScheduleDetails().getBufferOverDosageTimeInMinutes());
MotechEvent motechEvent = new MotechEvent(EventKeys.PILLREMINDER_REMINDER_EVENT_SUBJECT_SCHEDULER, eventParams);
String cronJobExpression = new CronJobSimpleExpressionBuilder(new Time(adjustedCronStartDateTime.toLocalTime())).build();
Date endDate = dosage.getEndDate() == null ? null : dosage.getEndDate().toDate();
Date startDate = DateUtil.newDateTime(adjustedCronStartDateTime.toDate()).isBefore(DateUtil.now()) ? DateUtil.now().toDate() : adjustedCronStartDateTime.toDate();
return new CronSchedulableJob(motechEvent, cronJobExpression, startDate, endDate);
}
}
代码示例来源:origin: org.motechproject/motech-decisiontree-server
/**
* Constructor to create CallDetailRecord
*
* @param startDate
* @param endDate
* @param answerDate
* @param disposition
* @param duration
*/
public CallDetailRecord(Date startDate, Date endDate, Date answerDate, Disposition disposition, Integer duration) {
this.startDate = startDate != null ? newDateTime(startDate) : null;
this.endDate = endDate != null ? newDateTime(endDate) : null;
this.answerDate = answerDate;
this.disposition = disposition;
this.duration = duration;
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static DateTime newDateTime(int year, int month, int day) {
return newDateTime(newDate(year, month, day), 0, 0, 0);
}
代码示例来源:origin: org.motechproject/motech-appointments-api
public DateTime originalDueDate() {
return DateUtil.setTimeZone(originalDueDate);
}
代码示例来源:origin: org.motechproject/motech-platform-commons-date
public static List<DayOfWeek> daysStarting(DayOfWeek day, int numberOfDays) {
List<DayOfWeek> days = new ArrayList<>();
for (int i = 0; i <= numberOfDays; i++) {
days.add(getDayOfWeek(DateUtil.today().withDayOfWeek(day.getValue()).plusDays(i)));
}
return days;
}
}
代码示例来源:origin: org.motechproject/motech-decisiontree-server
public CallDetailRecord(String callId, String phoneNumber) {
this.callId = callId;
this.phoneNumber = phoneNumber;
this.startDate = now();
}
代码示例来源:origin: org.motechproject/motech-platform-email
/**
* Gets the delivery time.
*
* @return the time that the email was sent
*/
public DateTime getDeliveryTime() {
return DateUtil.setTimeZoneUTC(deliveryTime);
}
代码示例来源:origin: org.motechproject/motech-scheduler
.forJob(jobDetail)
.withSchedule(cronSchedule)
.startAt(cronSchedulableJob.getStartTime() != null ? cronSchedulableJob.getStartTime() : now().toDate())
.endAt(cronSchedulableJob.getEndTime())
.build();
DateTime now = now();
if (cronSchedulableJob.isIgnorePastFiresAtStart() && newDateTime(cronSchedulableJob.getStartTime()).isBefore(now)) {
内容来源于网络,如有侵权,请联系作者删除!