本文整理汇总了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());
}