本文整理了Java中org.joda.time.DateTime.get()
方法的一些代码示例,展示了DateTime.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.get()
方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:get
暂无
代码示例来源:origin: apache/incubator-gobblin
public int getField(DateTime dateTime) {
return dateTime.get(this.dateTimeField);
}
代码示例来源:origin: apache/hive
public int parseInto(DateTimeParserBucket bucket, String text, int position) {
String substr = text.substring(position);
Matcher matcher = numericMatcher.get();
matcher.reset(substr);
if (!matcher.matches()) {
return -1;
}
// Joda DateTime only has precision to millis, cut off any fractional portion
long millis = Long.parseLong(matcher.group(1));
DateTime dt =
new DateTime(millis, ISOChronology.getInstanceUTC());
for (DateTimeFieldType field : dateTimeFields) {
bucket.saveField(field, dt.get(field));
}
return substr.length();
}
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-utility
public int getField(DateTime dateTime) {
return dateTime.get(this.dateTimeField);
}
代码示例来源:origin: org.apache.isis/applib
private boolean sameAs(final Date as, final DateTimeFieldType field) {
return date.get(field) == as.date.get(field);
}
代码示例来源:origin: org.apache.isis.core/isis-core-applib
private boolean sameAs(final Date as, final DateTimeFieldType field) {
return date.get(field) == as.date.get(field);
}
代码示例来源:origin: org.apache.gobblin/gobblin-utility
public int getField(DateTime dateTime) {
return dateTime.get(this.dateTimeField);
}
代码示例来源:origin: powertac/powertac-server
private String dateString (DateTime dateTime)
{
// Parse out year, month, day, and hour out of DateTime
int y = dateTime.get(DateTimeFieldType.year());
int m = dateTime.get(DateTimeFieldType.monthOfYear());
int d = dateTime.get(DateTimeFieldType.dayOfMonth());
int h = dateTime.get(DateTimeFieldType.clockhourOfDay()) % 24;
return String.format("%04d%02d%02d%02d", y, m, d, h);
}
代码示例来源:origin: powertac/powertac-server
private String dateStringLong (DateTime dateTime)
{
// Parse out year, month, day, and hour out of DateTime
int y = dateTime.get(DateTimeFieldType.year());
int m = dateTime.get(DateTimeFieldType.monthOfYear());
int d = dateTime.get(DateTimeFieldType.dayOfMonth());
int h = dateTime.get(DateTimeFieldType.clockhourOfDay()) % 24;
return String.format("%04d-%02d-%02d %02d:00", y, m, d, h);
}
代码示例来源:origin: se.vgregion.webbisar/webbisar-core-bc-composite-types
public BirthTime() {
Date date = new Date();
DateTime dt = new DateTime(date);
this.year = dt.get(DateTimeFieldType.year());
this.month = dt.get(DateTimeFieldType.monthOfYear());
this.day = dt.get(DateTimeFieldType.dayOfMonth());
this.hour = dt.get(DateTimeFieldType.hourOfDay());
this.minutes = dt.get(DateTimeFieldType.minuteOfHour());
}
代码示例来源:origin: se.vgregion.webbisar/webbisar-core-bc-composite-types
public BirthTime(Date date) {
DateTime dt = new DateTime(date);
this.year = dt.get(DateTimeFieldType.year());
this.month = dt.get(DateTimeFieldType.monthOfYear());
this.day = dt.get(DateTimeFieldType.dayOfMonth());
this.hour = dt.get(DateTimeFieldType.hourOfDay());
this.minutes = dt.get(DateTimeFieldType.minuteOfHour());
}
代码示例来源:origin: Unidata/thredds
public int getFieldValue(CalendarPeriod.Field fld) {
switch (fld) {
case Day: return dateTime.get(DateTimeFieldType.dayOfMonth());
case Hour: return dateTime.get(DateTimeFieldType.hourOfDay());
case Millisec: return dateTime.get(DateTimeFieldType.millisOfSecond());
case Minute: return dateTime.get(DateTimeFieldType.minuteOfHour());
case Month: return dateTime.get(DateTimeFieldType.monthOfYear());
case Second: return dateTime.get(DateTimeFieldType.secondOfMinute());
case Year: return dateTime.get(DateTimeFieldType.year());
}
throw new IllegalArgumentException("unimplemented "+fld);
}
代码示例来源:origin: org.apache.hive/hive-common
public int parseInto(DateTimeParserBucket bucket, String text, int position) {
String substr = text.substring(position);
Matcher matcher = numericMatcher.get();
matcher.reset(substr);
if (!matcher.matches()) {
return -1;
}
// Joda DateTime only has precision to millis, cut off any fractional portion
long millis = Long.parseLong(matcher.group(1));
DateTime dt =
new DateTime(millis, ISOChronology.getInstanceUTC());
for (DateTimeFieldType field : dateTimeFields) {
bucket.saveField(field, dt.get(field));
}
return substr.length();
}
}
代码示例来源:origin: com.graphaware.neo4j/timetree
private Node getInstantViaClosestChild(Node parent, DateTime dateTime, Resolution targetResolution, ChildNotFoundPolicy childNotFoundPolicy, Resolution newCurrentResolution, RelationshipType relationshipType) {
Node closestChild = findChild(parent, dateTime.get(newCurrentResolution.getDateTimeFieldType()), childNotFoundPolicy);
if (closestChild == null) {
return null;
}
return findChild(closestChild, relationshipType, targetResolution);
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public int getAcademicSemesterOfAcademicYear(final AcademicChronology academicChronology) {
return getBegin().withChronology(academicChronology).get(
AcademicSemesterOfAcademicYearDateTimeFieldType.academicSemesterOfAcademicYear());
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public AcademicSemesterCE minusSemester(int amount) {
int index = getStart().get(AcademicSemesterDateTimeFieldType.academicSemester());
return getAcademicChronology().getAcademicSemesterIn(index - amount);
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public AcademicSemesterCE plusSemester(int amount) {
int index = getStart().get(AcademicSemesterDateTimeFieldType.academicSemester());
return getAcademicChronology().getAcademicSemesterIn(index + amount);
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public AcademicYearCE minusYear(int amount) {
int index = getStart().get(AcademicYearDateTimeFieldType.academicYear());
return getAcademicChronology().getAcademicYearIn(index - amount);
}
代码示例来源:origin: FenixEdu/fenixedu-academic
public AcademicYearCE plusYear(int amount) {
int index = getStart().get(AcademicYearDateTimeFieldType.academicYear());
return getAcademicChronology().getAcademicYearIn(index + amount);
}
代码示例来源:origin: perfectsense/dari
protected DateTime every(DateTime currentTime, DateTimeFieldType unit, int offset, int interval) {
DateTime d = currentTime.property(unit).roundFloorCopy();
d = d.withFieldAdded(unit.getDurationType(), offset);
return d.withField(unit, (d.get(unit) / interval) * interval);
}
代码示例来源:origin: com.graphaware.neo4j/timetree
private Node getInstant(Node parent, DateTime dateTime, Resolution targetResolution, ChildNotFoundPolicy childNotFoundPolicy) {
Resolution currentResolution = currentResolution(parent);
if (targetResolution.equals(currentResolution)) {
return parent;
}
Resolution newCurrentResolution = childResolution(parent);
Node child = findChild(parent, dateTime.get(newCurrentResolution.getDateTimeFieldType()), RETURN_NULL);
if (child == null) {
switch (childNotFoundPolicy) {
case RETURN_NULL:
return null;
case RETURN_NEXT:
return getInstantViaClosestChild(parent, dateTime, targetResolution, childNotFoundPolicy, newCurrentResolution, FIRST);
case RETURN_PREVIOUS:
return getInstantViaClosestChild(parent, dateTime, targetResolution, childNotFoundPolicy, newCurrentResolution, LAST);
}
}
//recursion
return getInstant(child, dateTime, targetResolution, childNotFoundPolicy);
}
内容来源于网络,如有侵权,请联系作者删除!