本文整理了Java中java.time.OffsetDateTime.plusHours()
方法的一些代码示例,展示了OffsetDateTime.plusHours()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.plusHours()
方法的具体详情如下:
包路径:java.time.OffsetDateTime
类名称:OffsetDateTime
方法名:plusHours
[英]Returns a copy of this OffsetDateTime with the specified period in hours added.
This instance is immutable and unaffected by this method call.
[中]返回此OffsetDateTime的副本,并添加指定的时间段(以小时为单位)。
此实例是不可变的,不受此方法调用的影响。
代码示例来源:origin: com.github.seratch/java-time-backport
/**
* Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param hours the hours to subtract, may be negative
* @return an {@code OffsetDateTime} based on this date-time with the hours subtracted, not null
* @throws DateTimeException if the result exceeds the supported date range
*/
public OffsetDateTime minusHours(long hours) {
return (hours == Long.MIN_VALUE ? plusHours(Long.MAX_VALUE).plusHours(1) : plusHours(-hours));
}
代码示例来源:origin: Netflix/iceberg
static String humanHour(int hourOrdinal) {
OffsetDateTime time = EPOCH.plusHours(hourOrdinal);
return String.format("%04d-%02d-%02d-%02d",
time.getYear(), time.getMonth().getValue(), time.getDayOfMonth(), time.getHour());
}
代码示例来源:origin: org.openbase.bco/ontology.lib
/**
* Method adds/subtracts time from the current dateTime.
*
* @param minutes are the minutes.
* @param hours are the hours.
* @param days are the days.
* @param months are the months.
* @param years are the years.
* @return the changed dateTime as String.
*/
public static String addTimeToCurrentDateTime(final int minutes, final int hours, final int days, final int months, final int years) {
final OffsetDateTime now = OffsetDateTime.now();
now.plusMinutes(minutes);
now.plusHours(hours);
now.plusDays(days);
now.plusMonths(months);
now.plusYears(years);
return now.toString();
}
}
代码示例来源:origin: adorsys/xs2a
private List<SinglePayment> mapBulkPaymentToSinglePayments(BulkPaymentInitiationSctJson paymentRequest) {
return paymentRequest.getPayments().stream()
.map(p -> {
SinglePayment payment = new SinglePayment();
payment.setDebtorAccount(mapToXs2aAccountReference(paymentRequest.getDebtorAccount()));
payment.setRequestedExecutionDate(paymentRequest.getRequestedExecutionDate());
payment.setEndToEndIdentification(p.getEndToEndIdentification());
payment.setUltimateDebtor("NOT SUPPORTED");
payment.setInstructedAmount(amountModelMapper.mapToXs2aAmount(p.getInstructedAmount()));
payment.setCreditorAccount(mapToXs2aAccountReference(p.getCreditorAccount()));
payment.setCreditorAgent(p.getCreditorAgent());
payment.setCreditorName(p.getCreditorName());
payment.setCreditorAddress(accountModelMapper.mapToXs2aAddress(p.getCreditorAddress()));
payment.setUltimateCreditor(null);
payment.setPurposeCode(new Xs2aPurposeCode(null));
payment.setRemittanceInformationUnstructured(p.getRemittanceInformationUnstructured());
payment.setRemittanceInformationStructured(new Remittance());
payment.setRequestedExecutionTime(OffsetDateTime.now().plusHours(1));
return payment;
})
.collect(Collectors.toList());
}
代码示例来源:origin: de.adorsys.psd2/xs2a-impl
private List<SinglePayment> mapBulkPaymentToSinglePayments(BulkPaymentInitiationSctJson paymentRequest) {
return paymentRequest.getPayments().stream()
.map(p -> {
SinglePayment payment = new SinglePayment();
payment.setDebtorAccount(mapToXs2aAccountReference(paymentRequest.getDebtorAccount()));
payment.setRequestedExecutionDate(paymentRequest.getRequestedExecutionDate());
payment.setEndToEndIdentification(p.getEndToEndIdentification());
payment.setUltimateDebtor("NOT SUPPORTED");
payment.setInstructedAmount(amountModelMapper.mapToXs2aAmount(p.getInstructedAmount()));
payment.setCreditorAccount(mapToXs2aAccountReference(p.getCreditorAccount()));
payment.setCreditorAgent(p.getCreditorAgent());
payment.setCreditorName(p.getCreditorName());
payment.setCreditorAddress(accountModelMapper.mapToXs2aAddress(p.getCreditorAddress()));
payment.setUltimateCreditor(null);
payment.setPurposeCode(new Xs2aPurposeCode(null));
payment.setRemittanceInformationUnstructured(p.getRemittanceInformationUnstructured());
payment.setRemittanceInformationStructured(new Remittance());
payment.setRequestedExecutionTime(OffsetDateTime.now().plusHours(1));
return payment;
})
.collect(Collectors.toList());
}
代码示例来源:origin: de.adorsys.psd2/xs2a-impl
private PeriodicPayment mapToXs2aPeriodicPayment(PeriodicPaymentInitiationSctJson paymentRequest) {
PeriodicPayment payment = new PeriodicPayment();
payment.setEndToEndIdentification(paymentRequest.getEndToEndIdentification());
payment.setDebtorAccount(mapToXs2aAccountReference(paymentRequest.getDebtorAccount()));
payment.setUltimateDebtor("NOT SUPPORTED");
payment.setInstructedAmount(amountModelMapper.mapToXs2aAmount(paymentRequest.getInstructedAmount()));
payment.setCreditorAccount(mapToXs2aAccountReference(paymentRequest.getCreditorAccount()));
payment.setCreditorAgent(paymentRequest.getCreditorAgent());
payment.setCreditorName(paymentRequest.getCreditorName());
payment.setCreditorAddress(accountModelMapper.mapToXs2aAddress(paymentRequest.getCreditorAddress()));
payment.setUltimateCreditor(paymentRequest.getCreditorName());
payment.setPurposeCode(new Xs2aPurposeCode("N/A"));
payment.setRemittanceInformationUnstructured(paymentRequest.getRemittanceInformationUnstructured());
payment.setRemittanceInformationStructured(new Remittance());
payment.setRequestedExecutionDate(LocalDate.now());
payment.setRequestedExecutionTime(OffsetDateTime.now().plusHours(1));
payment.setStartDate(paymentRequest.getStartDate());
payment.setExecutionRule(mapToPisExecutionRule(paymentRequest.getExecutionRule()).orElse(null));
payment.setEndDate(paymentRequest.getEndDate());
payment.setFrequency(mapToXs2aFrequencyCode(paymentRequest.getFrequency()));
payment.setDayOfExecution(mapToPisDayOfExecution(paymentRequest.getDayOfExecution()).orElse(null));
return payment;
}
代码示例来源:origin: adorsys/xs2a
private PeriodicPayment mapToXs2aPeriodicPayment(PeriodicPaymentInitiationSctJson paymentRequest) {
PeriodicPayment payment = new PeriodicPayment();
payment.setEndToEndIdentification(paymentRequest.getEndToEndIdentification());
payment.setDebtorAccount(mapToXs2aAccountReference(paymentRequest.getDebtorAccount()));
payment.setUltimateDebtor("NOT SUPPORTED");
payment.setInstructedAmount(amountModelMapper.mapToXs2aAmount(paymentRequest.getInstructedAmount()));
payment.setCreditorAccount(mapToXs2aAccountReference(paymentRequest.getCreditorAccount()));
payment.setCreditorAgent(paymentRequest.getCreditorAgent());
payment.setCreditorName(paymentRequest.getCreditorName());
payment.setCreditorAddress(accountModelMapper.mapToXs2aAddress(paymentRequest.getCreditorAddress()));
payment.setUltimateCreditor(paymentRequest.getCreditorName());
payment.setPurposeCode(new Xs2aPurposeCode("N/A"));
payment.setRemittanceInformationUnstructured(paymentRequest.getRemittanceInformationUnstructured());
payment.setRemittanceInformationStructured(new Remittance());
payment.setRequestedExecutionDate(LocalDate.now());
payment.setRequestedExecutionTime(OffsetDateTime.now().plusHours(1));
payment.setStartDate(paymentRequest.getStartDate());
payment.setExecutionRule(mapToPisExecutionRule(paymentRequest.getExecutionRule()).orElse(null));
payment.setEndDate(paymentRequest.getEndDate());
payment.setFrequency(mapToXs2aFrequencyCode(paymentRequest.getFrequency()));
payment.setDayOfExecution(mapToPisDayOfExecution(paymentRequest.getDayOfExecution()).orElse(null));
return payment;
}
内容来源于网络,如有侵权,请联系作者删除!