本文整理了Java中org.joda.time.LocalDate.fromDateFields()
方法的一些代码示例,展示了LocalDate.fromDateFields()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.fromDateFields()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:fromDateFields
[英]Constructs a LocalDate from a java.util.Date
using exactly the same field values.
Each field is queried from the Date and assigned to the LocalDate. This is useful if you have been using the Date as a local date, ignoring the zone.
One advantage of this method is that this method is unaffected if the version of the time zone data differs between the JDK and Joda-Time. That is because the local field values are transferred, calculated using the JDK time zone data and without using the Joda-Time time zone data.
This factory method always creates a LocalDate with ISO chronology.
[中]
代码示例来源:origin: joda-time/joda-time
int dom = getDayOfMonth();
Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom);
LocalDate check = LocalDate.fromDateFields(date);
if (check.isBefore(this)) {
check = LocalDate.fromDateFields(date);
代码示例来源:origin: JodaOrg/joda-time
int dom = getDayOfMonth();
Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom);
LocalDate check = LocalDate.fromDateFields(date);
if (check.isBefore(this)) {
check = LocalDate.fromDateFields(date);
代码示例来源:origin: camunda/camunda-bpm-platform
int dom = getDayOfMonth();
Date date = new Date(getYear() - 1900, getMonthOfYear() - 1, dom);
LocalDate check = LocalDate.fromDateFields(date);
if (check.isBefore(this)) {
check = LocalDate.fromDateFields(date);
代码示例来源:origin: arnaudroger/SimpleFlatMapper
@Override
public LocalDate convert(Date in, Context context) throws Exception {
if (in == null) return null;
return LocalDate.fromDateFields(in);
}
}
代码示例来源:origin: br.com.anteros/Anteros-Persistence-Core
public LocalDate convertToEntityAttribute(Date date) {
return LocalDate.fromDateFields(date);
}
}
代码示例来源:origin: com.tomtom.speedtools/mongodb
@Nullable
@Override
public LocalDate fromDb(@Nullable final Object dbValue) throws MapperException {
if (dbValue == null) {
return null;
}
if (dbValue instanceof Date) {
return LocalDate.fromDateFields((Date) dbValue);
}
throw new MapperException("DateTime value expected, " +
"got a value of type: " + dbValue.getClass().getCanonicalName());
}
代码示例来源:origin: net.s-jr.utils.converterutils/joda-converter-utils
@Contract("null -> null; !null -> !null")
public static @Nullable LocalDate utilDateToJodaDate(final @Nullable Date d) {
if (d == null) {
return null;
}
return LocalDate.fromDateFields(d);
}
代码示例来源:origin: zhicwu/cassandra-jdbc-driver
@Override
public String format(Date value) {
if (value == null)
return "NULL";
return quote(FORMATTER.print(LocalDate.fromDateFields(value)));
}
代码示例来源:origin: joda-time/joda-time-hibernate
public Object nullSafeGet(ResultSet resultSet, String string) throws SQLException {
Object timestamp = StandardBasicTypes.DATE.nullSafeGet(resultSet, string);
if (timestamp == null) {
return null;
}
if (timestamp instanceof Date) {
return LocalDate.fromDateFields((Date) timestamp);
} else if (timestamp instanceof Calendar) {
return LocalDate.fromCalendarFields((Calendar) timestamp);
}
return new LocalDate(timestamp);
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
public void setActionDate(Date actionDate) {
setLocalDate(actionDate != null ? LocalDate.fromDateFields(actionDate) : null);
//LocalTime localTime = actionDateTime != null ? LocalTime.fromDateFields(actionDateTime) : LocalTime.MIDNIGHT;
if (localDate != null
&& localTime != null) {
actionDateTime = localDate.toDateTime(localTime).toDate();
}
}
代码示例来源:origin: JodaOrg/joda-time-hibernate
public Object nullSafeGet(ResultSet resultSet, String string) throws SQLException {
Object timestamp = StandardBasicTypes.DATE.nullSafeGet(resultSet, string);
if (timestamp == null) {
return null;
}
if (timestamp instanceof Date) {
return LocalDate.fromDateFields((Date) timestamp);
} else if (timestamp instanceof Calendar) {
return LocalDate.fromCalendarFields((Calendar) timestamp);
}
return new LocalDate(timestamp);
}
代码示例来源:origin: com.wuyushuo/vplus-data
/**
* 获取当前日期距离1970年多少天
* @param date 日期
* @return 距离1970年有多少天
*/
public static long getDaysTotal(Date date){
return Days.daysBetween(LOCAL_INIT_DATE, org.joda.time.LocalDate.fromDateFields(date)).getDays();
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
public EarnCode getPayoutEarnCodeObj() {
return HrServiceLocator.getEarnCodeService().getEarnCode(earnCode, LocalDate.fromDateFields(effectiveDate));
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
public AccrualCategory getCreditedAccrualCategory() {
return HrServiceLocator.getAccrualCategoryService().getAccrualCategory(toAccrualCategory, LocalDate.fromDateFields(effectiveDate));
}
代码示例来源:origin: qcadoo/mes
private Optional<LocalDate> resolveNextStartDate(final Entity assignmentToShift) {
LocalDate startDate = LocalDate.fromDateFields(assignmentToShift.getDateField(AssignmentToShiftFields.START_DATE));
Shift shift = shiftsFactory.buildFrom(assignmentToShift.getBelongsToField(AssignmentToShiftFields.SHIFT));
Entity factory = assignmentToShift.getBelongsToField(AssignmentToShiftFields.FACTORY);
Entity crew = assignmentToShift.getBelongsToField(AssignmentToShiftFields.CREW);
Set<LocalDate> occupiedDates = findNextStartDatesMatching(assignmentToShift.getDataDefinition(), startDate, shift,
factory, crew);
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
int daysInYear = cal.getActualMaximum(Calendar.DAY_OF_YEAR);
Iterable<Integer> daysRange = ContiguousSet.create(Range.closed(1, daysInYear), DiscreteDomain.integers());
return FluentIterable.from(daysRange).transform(startDate::plusDays).firstMatch((final LocalDate localDate) -> !occupiedDates.contains(localDate) && shift.worksAt(localDate));
}
代码示例来源:origin: com.synaptix/SynaptixWidget
@Override
public void actionPerformed(ActionEvent e) {
popupMenu.setVisible(false);
Date date = monthView.getSelectionDate();
if (date != null) {
formattedTextField.setValue(LocalDate.fromDateFields(date));
} else {
formattedTextField.setValue(null);
}
}
});
代码示例来源:origin: zhicwu/cassandra-jdbc-driver
@Override
public ByteBuffer serialize(Date value, ProtocolVersion protocolVersion) {
if (value == null)
return null;
Days days = daysBetween(EPOCH, LocalDate.fromDateFields(value));
int unsigned = fromSignedToUnsignedInt(days.getDays());
return cint().serializeNoBoxing(unsigned, protocolVersion);
}
代码示例来源:origin: qcadoo/mes
@Override
public DeviationSummary apply(final Entity projection) {
String deviationCause = projection.getStringField("deviationCause");
LocalDate date = LocalDate.fromDateFields(projection.getDateField("date"));
String orderNumber = projection.getStringField("orderNumber");
String productNumber = projection.getStringField("productNumber");
String comment = projection.getStringField("comment");
return new DeviationSummary(deviationCause, date, orderNumber, productNumber, comment);
}
};
代码示例来源:origin: qcadoo/mes
private static ProductionProgressScope scopeFrom(final Entity projection) {
LocalDate day = LocalDate.fromDateFields(projection.getDateField(SHIFT_START_DAY_ALIAS));
return new ProductionProgressScope(day, orderFrom(projection), operationFrom(projection), shiftFrom(projection),
productFrom(projection));
}
代码示例来源:origin: jclehner/rxdroid
@Override
public void initPreference(AdvancedDialogPreference preference, Object fieldValue)
{
super.initPreference(preference, fieldValue);
preference.setCheckable(true);
final LocalDate minDate = LocalDate.fromDateFields(
Settings.getDoseTimeInfo().activeDate()).plusDays(1);
((DatePreference) preference).setMinDate(minDate);
}
内容来源于网络,如有侵权,请联系作者删除!