当前位置: 首页>>代码示例>>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;未经允许,请勿转载。