本文整理汇总了Java中org.joda.time.DateTime.withZone方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.withZone方法的具体用法?Java DateTime.withZone怎么用?Java DateTime.withZone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTime
的用法示例。
在下文中一共展示了DateTime.withZone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KubernetesInstance
import org.joda.time.DateTime; //导入方法依赖的package包/类
public KubernetesInstance(DateTime createdAt, String environment, String name, Map<String, String> properties, Long jobId, PodState state) {
this.createdAt = createdAt.withZone(DateTimeZone.UTC);
this.environment = environment;
this.name = name;
this.properties = properties;
this.jobId = jobId;
this.state = state;
}
示例2: prepareForAssignment
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* A helper function for derived classes that checks to see if the old and new value are equal and if so releases
* the cached dom. Derived classes are expected to use this thus: <code>
* this.foo = prepareForAssignment(this.foo, foo);
* </code>
*
* This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriate
*
* @param oldValue - current value
* @param newValue - proposed new value
*
* @return The value to assign to the saved Object.
*/
protected DateTime prepareForAssignment(DateTime oldValue, DateTime newValue) {
DateTime utcValue = null;
if (newValue != null) {
utcValue = newValue.withZone(DateTimeZone.UTC);
}
return super.prepareForAssignment(oldValue, utcValue);
}
示例3: prepareForAssignment
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* A helper function for derived classes that checks to see if the old and new value are equal and if so releases
* the cached dom. Derived classes are expected to use this thus: <code>
* this.foo = prepareForAssignment(this.foo, foo);
* </code>
*
* This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriate
*
* @param oldValue - current value
* @param newValue - proposed new value
*
* @return The value to assign to the saved Object
*/
protected DateTime prepareForAssignment(DateTime oldValue, DateTime newValue) {
DateTime utcValue = null;
if (newValue != null) {
utcValue = newValue.withZone(DateTimeZone.UTC);
}
return super.prepareForAssignment(oldValue, utcValue);
}
示例4: assertDateTimeEquals
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* This method compares two {@link DateTime} objects, ignoring their time zones.
*
* @param actual
* the actual value
* @param expected
* the expected value
* @param msg
* a message to use
*/
public static void assertDateTimeEquals(DateTime actual, DateTime expected, String msg) {
if (!actual.getZone().equals(expected.getZone())) {
actual = actual.withZone(expected.getZone());
}
assertEquals(actual, expected, msg);
}