當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTime.withZone方法代碼示例

本文整理匯總了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;
}
 
開發者ID:gocd,項目名稱:kubernetes-elastic-agents,代碼行數:9,代碼來源:KubernetesInstance.java

示例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);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:AbstractSAMLObject.java

示例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);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:AbstractSignableSAMLObject.java

示例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);
}
 
開發者ID:SolarNetwork,項目名稱:killbill-easytax-plugin,代碼行數:17,代碼來源:EasyTaxTestUtils.java


注:本文中的org.joda.time.DateTime.withZone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。