org.joda.time.Partial.toDateTime()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.joda.time.Partial.toDateTime()方法的一些代码示例,展示了Partial.toDateTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partial.toDateTime()方法的具体详情如下:
包路径:org.joda.time.Partial
类名称:Partial
方法名:toDateTime

Partial.toDateTime介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial resolveDowToDay(Partial p)
{
 if (p.isSupported(DateTimeFieldType.dayOfWeek())) {
  if (!p.isSupported(DateTimeFieldType.dayOfMonth())) {
   if (p.isSupported(DateTimeFieldType.weekOfWeekyear()) && (p.isSupported(DateTimeFieldType.year()))) {
    // Convert from year to weekyear (to avoid weirdness when the weekyear and year don't match at the beginning of the year)
    Partial pwy = withWeekYear(p);
    Instant t2 = getInstant(pwy);
    DateTime t1 = pwy.toDateTime(t2);
    Partial res = getPartial(t1.toInstant(), EMPTY_ISO_PARTIAL);
    DateTimeFieldType mostSpecific = getMostSpecific(p);
    res = discardMoreSpecificFields(res, mostSpecific.getDurationType());
    return res;
   }
  }
 }
 return p;
}

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial resolveWeek(Partial p1, Partial p2)
{
 if (isCompatible(p1,p2)) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1));
    }
  }
 }
 return p1;
}
public static Partial resolveWeek(Partial p)

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial resolveDowToDay(Partial p1, Partial p2)
{
 // Discard anything that's more specific than dayOfMonth for p2
 p2 = JodaTimeUtils.discardMoreSpecificFields(p2, DateTimeFieldType.dayOfMonth());
 if (isCompatible(p1,p2)) {
  if (p1.isSupported(DateTimeFieldType.dayOfWeek())) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.with(DateTimeFieldType.dayOfMonth(), 1)/*.with(DateTimeFieldType.weekOfWeekyear(), 1) */);
    }
   }
  }
 }
 return p1;
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public ExtraCurricularActivity(Student student, ExtraCurricularActivityType type, Partial start, Partial end) {
  this(student, type, new Interval(start.toDateTime(new DateTime(0)), end.toDateTime(new DateTime(0))));
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public void setEnd(Partial end) {
  setActivityInterval(new Interval(getActivityInterval().getStart(), end.toDateTime(new DateTime(0))));
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public void setStart(Partial start) {
  setActivityInterval(new Interval(start.toDateTime(new DateTime(0)), getActivityInterval().getEnd()));
}

代码示例来源:origin: org.opencds.cqf/cql-engine

org.joda.time.DateTime leftDateTime = isDateTime ? leftTemporal.getJodaDateTime() : leftTrunc.toDateTime(new org.joda.time.DateTime(leftTemporal.getTimezone()));
org.joda.time.DateTime rightDateTime = isDateTime ? rightTemporal.getJodaDateTime() : rightTrunc.toDateTime(new org.joda.time.DateTime(rightTemporal.getTimezone()));

代码示例来源:origin: com.guokr/stan-cn-com

public static Partial resolveDowToDay(Partial p)
{
 if (p.isSupported(DateTimeFieldType.dayOfWeek())) {
  if (!p.isSupported(DateTimeFieldType.dayOfMonth())) {
   if (p.isSupported(DateTimeFieldType.weekOfWeekyear()) && p.isSupported(DateTimeFieldType.year())) {
    Instant t2 = getInstant(p);
    DateTime t1 = p.toDateTime(t2);
    Partial res = getPartial(t1.toInstant(), EMPTY_ISO_PARTIAL);
    DateTimeFieldType mostSpecific = getMostSpecific(p);
    res = discardMoreSpecificFields(res, mostSpecific.getDurationType());
    return res;
   }
  }
 }
 return p;
}
// Uses p2 to resolve week for p1

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial resolveDowToDay(Partial p)
{
 if (p.isSupported(DateTimeFieldType.dayOfWeek())) {
  if (!p.isSupported(DateTimeFieldType.dayOfMonth())) {
   if (p.isSupported(DateTimeFieldType.weekOfWeekyear()) && p.isSupported(DateTimeFieldType.year())) {
    Instant t2 = getInstant(p);
    DateTime t1 = p.toDateTime(t2);
    Partial res = getPartial(t1.toInstant(), EMPTY_ISO_PARTIAL);
    DateTimeFieldType mostSpecific = getMostSpecific(p);
    res = discardMoreSpecificFields(res, mostSpecific.getDurationType());
    return res;
   }
  }
 }
 return p;
}
// Uses p2 to resolve week for p1

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Partial resolveDowToDay(Partial p)
{
 if (p.isSupported(DateTimeFieldType.dayOfWeek())) {
  if (!p.isSupported(DateTimeFieldType.dayOfMonth())) {
   if (p.isSupported(DateTimeFieldType.weekOfWeekyear()) && (p.isSupported(DateTimeFieldType.year()))) {
    // Convert from year to weekyear (to avoid weirdness when the weekyear and year don't match at the beginning of the year)
    Partial pwy = withWeekYear(p);
    Instant t2 = getInstant(pwy);
    DateTime t1 = pwy.toDateTime(t2);
    Partial res = getPartial(t1.toInstant(), EMPTY_ISO_PARTIAL);
    DateTimeFieldType mostSpecific = getMostSpecific(p);
    res = discardMoreSpecificFields(res, mostSpecific.getDurationType());
    return res;
   }
  }
 }
 return p;
}

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial resolveDowToDay(Partial p1, Partial p2)
{
 if (isCompatible(p1,p2)) {
  if (p1.isSupported(DateTimeFieldType.dayOfWeek())) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.with(DateTimeFieldType.dayOfMonth(), 1)/*.with(DateTimeFieldType.weekOfWeekyear(), 1) */);
    }
   }
  }
 }
 return p1;
}
// Resolve dow for p1

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Partial resolveWeek(Partial p1, Partial p2)
{
 if (isCompatible(p1,p2)) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1));
    }
  }
 }
 return p1;
}
public static Partial resolveWeek(Partial p)

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial resolveWeek(Partial p1, Partial p2)
{
 if (isCompatible(p1,p2)) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1));
    }
  }
 }
 return p1;
}
public static Instant getInstant(Partial p)

代码示例来源:origin: com.guokr/stan-cn-com

public static Partial resolveWeek(Partial p1, Partial p2)
{
 if (isCompatible(p1,p2)) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.without(DateTimeFieldType.dayOfMonth()).without(DateTimeFieldType.monthOfYear()).with(DateTimeFieldType.weekOfWeekyear(), 1));
    }
  }
 }
 return p1;
}
public static Partial resolveWeek(Partial p)

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

public static Partial resolveDowToDay(Partial p1, Partial p2)
{
 // Discard anything that's more specific than dayOfMonth for p2
 p2 = JodaTimeUtils.discardMoreSpecificFields(p2, DateTimeFieldType.dayOfMonth());
 if (isCompatible(p1,p2)) {
  if (p1.isSupported(DateTimeFieldType.dayOfWeek())) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.with(DateTimeFieldType.dayOfMonth(), 1)/*.with(DateTimeFieldType.weekOfWeekyear(), 1) */);
    }
   }
  }
 }
 return p1;
}

代码示例来源:origin: com.guokr/stan-cn-com

public static Partial resolveDowToDay(Partial p1, Partial p2)
{
 // Discard anything that's more specific than dayOfMonth for p2
 p2 = JodaTimeUtils.discardMoreSpecificFields(p2, DateTimeFieldType.dayOfMonth());
 if (isCompatible(p1,p2)) {
  if (p1.isSupported(DateTimeFieldType.dayOfWeek())) {
   if (!p1.isSupported(DateTimeFieldType.dayOfMonth())) {
    if (p2.isSupported(DateTimeFieldType.dayOfMonth()) && p2.isSupported(DateTimeFieldType.monthOfYear()) && p2.isSupported(DateTimeFieldType.year())) {
     Instant t2 = getInstant(p2);
     DateTime t1 = p1.toDateTime(t2);
     return getPartial(t1.toInstant(), p1.with(DateTimeFieldType.dayOfMonth(), 1)/*.with(DateTimeFieldType.weekOfWeekyear(), 1) */);
    }
   }
  }
 }
 return p1;
}
// Resolve dow for p1

相关文章