本文整理了Java中org.joda.time.Instant.toMutableDateTime()
方法的一些代码示例,展示了Instant.toMutableDateTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.toMutableDateTime()
方法的具体详情如下:
包路径:org.joda.time.Instant
类名称:Instant
方法名:toMutableDateTime
[英]Get this object as a MutableDateTime using ISOChronology in the default zone.
This method returns a MutableDateTime object in the default zone. This differs from the similarly named method on DateTime, DateMidnight or MutableDateTime which retains the time zone. The difference is because Instant really represents a time without a zone, thus calling this method we really have no zone to 'retain' and hence expect to switch to the default zone.
This method definition preserves compatibility with earlier versions of Joda-Time.
[中]使用默认区域中的等时方法将此对象作为可变日期时间获取。
此方法返回默认区域中的MutableDateTime对象。这与保留时区的DateTime、DateMidnight或MutableDateTime上类似命名的方法不同。区别在于Instant实际上表示一个没有区域的时间,因此调用此方法时,我们实际上没有要“保留”的区域,因此希望切换到默认区域。
此方法定义保留了与Joda Time早期版本的兼容性。
代码示例来源:origin: JodaOrg/joda-time
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: joda-time/joda-time
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public GroundedTime setTimeZone(DateTimeZone tz) {
MutableDateTime tzBase = base.toInstant().toMutableDateTime();
tzBase.setZone(tz); // TODO: setZoneRetainFields?
return new GroundedTime(this, tzBase);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: org.joda/com.springsource.org.joda.time
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method definition preserves compatability with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: Nextdoor/bender
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Get this object as a MutableDateTime using ISOChronology in the default zone.
* This method is identical to <code>toMutableDateTime()</code>.
* <p>
* This method returns a MutableDateTime object in the default zone.
* This differs from the similarly named method on DateTime, DateMidnight
* or MutableDateTime which retains the time zone. The difference is
* because Instant really represents a time <i>without</i> a zone,
* thus calling this method we really have no zone to 'retain' and
* hence expect to switch to the default zone.
* <p>
* This method is deprecated because it is a duplicate of {@link #toMutableDateTime()}.
* However, removing it would cause the superclass implementation to be used,
* which would create silent bugs in any caller depending on this implementation.
* As such, the method itself is not currently planned to be removed.
* <p>
* This method definition preserves compatibility with earlier versions
* of Joda-Time.
*
* @return a MutableDateTime using the same millis with ISOChronology
* @deprecated Use toMutableDateTime() as it is identical
*/
@Deprecated
public MutableDateTime toMutableDateTimeISO() {
return toMutableDateTime();
}
代码示例来源:origin: edu.stanford.nlp/stanford-corenlp
@Override
public GroundedTime setTimeZone(DateTimeZone tz) {
MutableDateTime tzBase = base.toInstant().toMutableDateTime();
tzBase.setZone(tz); // TODO: setZoneRetainFields?
return new GroundedTime(this, tzBase);
}
代码示例来源:origin: com.guokr/stan-cn-com
public GroundedTime setTimeZone(DateTimeZone tz) {
MutableDateTime tzBase = base.toInstant().toMutableDateTime();
tzBase.setZone(tz); // TODO: setZoneRetainFields?
return new GroundedTime(this, tzBase);
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
MutableDateTime mutableNow = Instant.now().toMutableDateTime();
mutableNow.setMillisOfSecond(0);
Instant now = mutableNow.toInstant();
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
@Test
@Category(ValidatesRunner.class)
public void testSideInputsWithMultipleWindows() {
// Tests that the runner can safely run a DoFn that uses side inputs
// on an input where the element is in multiple windows. The complication is
// that side inputs are per-window, so the runner has to make sure
// to process each window individually.
MutableDateTime mutableNow = Instant.now().toMutableDateTime();
mutableNow.setMillisOfSecond(0);
Instant now = mutableNow.toInstant();
SlidingWindows windowFn =
SlidingWindows.of(Duration.standardSeconds(5)).every(Duration.standardSeconds(1));
PCollectionView<Integer> view = pipeline.apply(Create.of(1)).apply(View.asSingleton());
PCollection<String> res =
pipeline
.apply(Create.timestamped(TimestampedValue.of("a", now)))
.apply(Window.into(windowFn))
.apply(ParDo.of(new FnWithSideInputs(view)).withSideInputs(view));
for (int i = 0; i < 4; ++i) {
Instant base = now.minus(Duration.standardSeconds(i));
IntervalWindow window = new IntervalWindow(base, base.plus(Duration.standardSeconds(5)));
PAssert.that(res).inWindow(window).containsInAnyOrder("a:1");
}
pipeline.run();
}
内容来源于网络,如有侵权,请联系作者删除!