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


Java DateTime.toDateTime方法代碼示例

本文整理匯總了Java中org.joda.time.DateTime.toDateTime方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.toDateTime方法的具體用法?Java DateTime.toDateTime怎麽用?Java DateTime.toDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTime的用法示例。


在下文中一共展示了DateTime.toDateTime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOverflowDate

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Test
public void getOverflowDate() throws Exception {
    DateTime result = client.datetimes().getOverflow();
    // 9999-12-31T23:59:59.999-14:000
    DateTime expected = new DateTime(9999, 12, 31, 23, 59, 59, 999, DateTimeZone.forOffsetHours(-14));
    expected = expected.toDateTime(DateTimeZone.UTC);
    Assert.assertEquals(expected, result);
}
 
開發者ID:Azure,項目名稱:autorest.java,代碼行數:9,代碼來源:DatetimeOperationsTests.java

示例2: getOverflowDate

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Test
public void getOverflowDate() throws Exception {
    DateTime result = client.datetimerfc1123s().getOverflow();
    DateTime expected = new DateTime(10000, 1, 1, 00, 00, 00, 0, DateTimeZone.UTC);
    expected = expected.toDateTime(DateTimeZone.UTC);
    Assert.assertEquals(expected, result);
}
 
開發者ID:Azure,項目名稱:autorest.java,代碼行數:8,代碼來源:DateTimeRfc1123OperationsTests.java

示例3: jodaDateTimeToJavaInstantSuccessful

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Test
public void jodaDateTimeToJavaInstantSuccessful() {
    DateTime jodaDateTimeUtc = DateTime.now(UTC);
    DateTime jodaDateTimeInDefaultZone = jodaDateTimeUtc.toDateTime(DateTimeZone.getDefault());

    assertThat(jodaDateTimeToJavaInstant(jodaDateTimeInDefaultZone), equalTo(Instant.ofEpochMilli(jodaDateTimeUtc.getMillis())));
}
 
開發者ID:alphagov,項目名稱:verify-matching-service-adapter,代碼行數:8,代碼來源:JodaAndJavaDateTimeConvertersTest.java

示例4: jodaDataTimeToInstantProviderSuccessful

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Test
public void jodaDataTimeToInstantProviderSuccessful() {
    DateTime jodaDateTimeUtc = DateTime.now(UTC);
    DateTime jodaDateTimeInDefaultZone = jodaDateTimeUtc.toDateTime(DateTimeZone.getDefault());

    Function<Object, Instant> javaInstantProvider = jodaDataTimeToInstantProvider(context -> jodaDateTimeInDefaultZone);

    assertThat(javaInstantProvider.apply(new Object()), equalTo(Instant.ofEpochMilli(jodaDateTimeUtc.getMillis())));
}
 
開發者ID:alphagov,項目名稱:verify-matching-service-adapter,代碼行數:10,代碼來源:JodaAndJavaDateTimeConvertersTest.java

示例5: dateToString

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * Date format stored in firebase will be local time string
 * yyyy-MM-dd was picked because it is sortable
 * @param date UTC datetime
 * @return yyyy-MM-dd format date string of date converted to local time
 */
public static String dateToString(DateTime date) {
    date = date.toDateTime(localTimeZone);
    return dateFormatter.print(date.toInstant());
}
 
開發者ID:CMPUT301F17T13,項目名稱:cat-is-a-dog,代碼行數:11,代碼來源:FirebaseUtil.java


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