本文整理汇总了Java中sample.util.DateUtils类的典型用法代码示例。如果您正苦于以下问题:Java DateUtils类的具体用法?Java DateUtils怎么用?Java DateUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DateUtils类属于sample.util包,在下文中一共展示了DateUtils类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: find
import sample.util.DateUtils; //导入依赖的package包/类
@Test
public void find() {
CashInOut cio = fixtures.cio(accId, "300", true);
cio.setUpdateDate(DateUtils.date("20141118"));
cio.save(rep);
//low: ちゃんとやると大変なので最低限の検証
assertThat(
CashInOut.find(rep, findParam("20141118", "20141119")),
hasSize(1));
assertThat(
CashInOut.find(rep, findParam("20141118", "20141119", ActionStatusType.UNPROCESSED)),
hasSize(1));
assertThat(
CashInOut.find(rep, findParam("20141118", "20141119", ActionStatusType.PROCESSED)),
empty());
assertThat(
CashInOut.find(rep, findParam("20141119", "20141120", ActionStatusType.UNPROCESSED)),
empty());
}
示例2: finish
import sample.util.DateUtils; //导入依赖的package包/类
/** イベント監査ログを完了状態にします。 */
public AuditEvent finish(final SystemRepository rep) {
LocalDateTime now = rep.dh().time().date();
setStatusType(ActionStatusType.Processed);
setEndDate(now);
setTime(DateUtils.between(startDate, endDate).get().toMillis());
return update(rep);
}
示例3: cancel
import sample.util.DateUtils; //导入依赖的package包/类
/** イベント監査ログを取消状態にします。 */
public AuditEvent cancel(final SystemRepository rep, String errorReason) {
LocalDateTime now = rep.dh().time().date();
setStatusType(ActionStatusType.Cancelled);
setErrorReason(StringUtils.abbreviate(errorReason, 250));
setEndDate(now);
setTime(DateUtils.between(startDate, endDate).get().toMillis());
return update(rep);
}
示例4: error
import sample.util.DateUtils; //导入依赖的package包/类
/** イベント監査ログを例外状態にします。 */
public AuditEvent error(final SystemRepository rep, String errorReason) {
LocalDateTime now = rep.dh().time().date();
setStatusType(ActionStatusType.Error);
setErrorReason(StringUtils.abbreviate(errorReason, 250));
setEndDate(now);
setTime(DateUtils.between(startDate, endDate).get().toMillis());
return update(rep);
}
示例5: find
import sample.util.DateUtils; //导入依赖的package包/类
/** イベント監査ログを検索します。 */
public static PagingList<AuditEvent> find(final SystemRepository rep, final FindAuditEvent p) {
return rep.tmpl().find(AuditEvent.class, (criteria) -> {
return criteria
.equal("category", p.category)
.equal("statusType", p.statusType)
.like(new String[] { "message", "errorReason" }, p.keyword, MatchMode.ANYWHERE)
.between("startDate", p.fromDay.atStartOfDay(), DateUtils.dateTo(p.toDay));
}, p.page.sortIfEmpty(SortOrder.desc("startDate")));
}
示例6: holiday
import sample.util.DateUtils; //导入依赖的package包/类
/** 祝日の簡易生成 */
public Holiday holiday(String dayStr) {
Holiday m = new Holiday();
m.setCategory(Holiday.CategoryDefault);
m.setName("休日サンプル");
m.setDay(DateUtils.day(dayStr));
return m;
}
示例7: RegHolidayItem
import sample.util.DateUtils; //导入依赖的package包/类
@Test
public void 休日を登録する() {
List<RegHolidayItem> items = Arrays.asList("2016-09-21", "2016-09-22", "2016-09-23")
.stream().map((s) -> new RegHolidayItem(DateUtils.day(s), "休日")).collect(Collectors.toList());
tx(() -> {
Holiday.register(rep, new RegHoliday(2016, items));
assertThat(Holiday.find(rep, 2016), hasSize(3));
});
}
示例8: given
import sample.util.DateUtils; //导入依赖的package包/类
@Test
public void 振込入出金依頼を検索します() throws Exception {
String day = DateUtils.dayFormat(LocalDate.now());
given(service.findCashInOut(any(FindCashInOut.class))).willReturn(resultCashInOuts());
performGet(
uriBuilder("/cio/")
.queryParam("updFromDay", day)
.queryParam("updToDay", day)
.build(),
JsonExpects.success()
.match("$[0].currency", "JPY")
.match("$[0].absAmount", 3000)
.match("$[1].absAmount", 8000));
}
示例9: RegHolidayItem
import sample.util.DateUtils; //导入依赖的package包/类
@Test
public void 休日を登録する() {
MutableList<RegHolidayItem> items = Lists.mutable
.of("2016-09-21", "2016-09-22", "2016-09-23")
.collect((s) -> new RegHolidayItem(DateUtils.day(s), "休日"));
tx(() -> {
Holiday.register(rep, new RegHoliday(2016, items));
assertThat(Holiday.find(rep, 2016), hasSize(3));
});
}
示例10: isHolidayOrWeeekDay
import sample.util.DateUtils; //导入依赖的package包/类
/** 祝日もしくは週末時はtrue。 */
private boolean isHolidayOrWeeekDay(LocalDate day) {
return (DateUtils.isWeekend(day) || isHoliday(day));
}
示例11: initializeInTxSystem
import sample.util.DateUtils; //导入依赖的package包/类
public void initializeInTxSystem() {
String day = DateUtils.dayFormat(LocalDate.now());
new AppSetting(Timestamper.KeyDay, "system", "営業日", day).save(repSystem);
}
示例12: find
import sample.util.DateUtils; //导入依赖的package包/类
public static List<Holiday> find(final OrmRepository rep, final int year, final String category) {
return rep.tmpl().find("from Holiday h where h.category=?1 and h.day between ?2 and ?3 order by h.day",
category, LocalDate.ofYearDay(year, 1), DateUtils.dayTo(year));
}
示例13: register
import sample.util.DateUtils; //导入依赖的package包/类
/** 休日マスタを登録します。 */
public static void register(final OrmRepository rep, final RegHoliday p) {
rep.tmpl().execute("delete from Holiday h where h.category=?1 and h.day between ?2 and ?3",
p.category, LocalDate.ofYearDay(p.year, 1), DateUtils.dayTo(p.year));
p.list.forEach(v -> v.create(p).save(rep));
}