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