本文整理匯總了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);
}