本文整理了Java中org.joda.time.LocalTime.fromDateFields()
方法的一些代码示例,展示了LocalTime.fromDateFields()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.fromDateFields()
方法的具体详情如下:
包路径:org.joda.time.LocalTime
类名称:LocalTime
方法名:fromDateFields
[英]Constructs a LocalTime from a java.util.Date
using exactly the same field values.
Each field is queried from the Date and assigned to the LocalTime. This is useful if you have been using the Date as a local time, 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 LocalTime with ISO chronology.
[中]使用完全相同的字段值从java.util.Date
构造LocalTime。
从日期开始查询每个字段,并将其分配给LocalTime。如果您一直将日期用作本地时间,而忽略区域,则此选项非常有用。
此方法的一个优点是,如果时区数据的版本在JDK和Joda时间之间不同,则此方法不受影响。这是因为本地字段值是使用JDK时区数据传输、计算的,而不使用Joda时区数据。
此工厂方法始终使用ISO时间顺序创建LocalTime。
代码示例来源:origin: arnaudroger/SimpleFlatMapper
@Override
public LocalTime convert(Date in, Context context) throws Exception {
if (in == null) return null;
return LocalTime.fromDateFields(in);
}
}
代码示例来源:origin: net.s-jr.utils.converterutils/joda-converter-utils
@Contract("null -> null; !null -> !null")
public static @Nullable LocalTime utilDateToJodaTime(final @Nullable Date d) {
if (d == null) {
return null;
}
return LocalTime.fromDateFields(d);
}
代码示例来源:origin: org.jboss.oreva/odata-core
/**
* Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
*
* @param name the property name
* @param value the property value
* @return a new OData property instance
*/
public static OProperty<LocalTime> time(String name, Date value) {
return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null);
}
代码示例来源:origin: org.sonatype.sisu/sisu-odata4j
/**
* Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
*
* @param name the property name
* @param value the property value
* @return a new OData property instance
*/
public static OProperty<LocalTime> time(String name, Date value) {
return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null);
}
代码示例来源:origin: odata4j/odata4j
/**
* Creates a new LocalTime-valued OData property with {@link EdmSimpleType#TIME}
*
* @param name the property name
* @param value the property value
* @return a new OData property instance
*/
public static OProperty<LocalTime> time(String name, Date value) {
return new Impl<LocalTime>(name, EdmSimpleType.TIME, value != null ? LocalTime.fromDateFields(value) : null);
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
public String getActionTime() {
return actionDateTime != null ? FORMATTER.print(LocalTime.fromDateFields(actionDateTime)) : getLocalTimeString();
}
代码示例来源:origin: org.sonatype.sisu/sisu-odata4j
return (T) new LocalTime(obj);
else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class))
return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
return (T) LocalTime.fromCalendarFields((Calendar) obj);
代码示例来源:origin: odata4j/odata4j
return (T) new LocalTime(obj);
else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class))
return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
return (T) LocalTime.fromCalendarFields((Calendar) obj);
代码示例来源:origin: org.jboss.oreva/odata-core
return (T) new LocalTime(obj);
else if (Date.class.isAssignableFrom(objClass) && !objClass.equals(java.sql.Date.class))
return (T) LocalTime.fromDateFields((Date) obj);
else if (Calendar.class.isAssignableFrom(objClass))
return (T) LocalTime.fromCalendarFields((Calendar) obj);
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
protected List<Shift> createShifts(ShiftDifferentialRule rule, LocalDateTime spanBegin, LocalDateTime spanEnd, DateTimeZone zone) {
DateTime spanBeginDT = spanBegin.toDateTime(zone);
DateTime spanEndDT = spanEnd.toDateTime(zone);
Interval calendarEntryInterval = new Interval(spanBeginDT, spanEndDT);
DateTime shiftEnd = LocalTime.fromDateFields(rule.getEndTime()).toDateTime(spanBeginDT).minusDays(1);
DateTime shiftStart = LocalTime.fromDateFields(rule.getBeginTime()).toDateTime(spanBeginDT).minusDays(1);
if (shiftEnd.isBefore(shiftStart) || shiftEnd.isEqual(shiftStart)) {
shiftEnd = shiftEnd.plusDays(1);
}
List<Shift> shifts = new ArrayList<Shift>();
Interval shiftInterval = new Interval(shiftStart, shiftEnd);
//possible that there is no overlap between 1st interval and cal entry interval... if so, add a day.
if (!calendarEntryInterval.overlaps(shiftInterval)) {
shiftInterval = incrementShift(shiftInterval);
}
while (calendarEntryInterval.overlaps(shiftInterval)) {
if (ruleIsActiveForDay(shiftInterval.getStart(), rule)) {
shifts.add(new Shift(rule, shiftInterval, zone));
}
shiftInterval = incrementShift(shiftInterval);
}
return shifts;
}
内容来源于网络,如有侵权,请联系作者删除!