当前位置: 首页>>代码示例>>Java>>正文


Java ZonedDateTime.parse方法代码示例

本文整理汇总了Java中org.threeten.bp.ZonedDateTime.parse方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.parse方法的具体用法?Java ZonedDateTime.parse怎么用?Java ZonedDateTime.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.threeten.bp.ZonedDateTime的用法示例。


在下文中一共展示了ZonedDateTime.parse方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compare

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public int compare(final String arg0, final String arg1) {
  try {
    final ZonedDateTime zdt0 = ZonedDateTime.parse(arg0);
    final ZonedDateTime zdt1 = ZonedDateTime.parse(arg1);
    return zdt0.compareTo(zdt1);
  } catch (final DateTimeParseException e1) {
    try {
      final LocalDate ld0 = LocalDate.parse(arg0);
      final LocalDate ld1 = LocalDate.parse(arg1);
      return ld0.compareTo(ld1);
    } catch (final DateTimeParseException e2) {
      return arg0.compareTo(arg1);
    }
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:17,代码来源:ExpiryAggregationFunction.java

示例2: compare

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public int compare(User firstUser, User secondUser) {
    ZonedDateTime firstUserParsedTimeStamp = ZonedDateTime.parse(firstUser.getJoinedTimeStamp());
    ZonedDateTime secondUserParsedTimeStamp = ZonedDateTime.parse(secondUser.getJoinedTimeStamp());
    if (firstUserParsedTimeStamp.isAfter(secondUserParsedTimeStamp)) {
        return 1;
    }
    else {
        return -1;
    }
}
 
开发者ID:ZinoKader,项目名称:SpotiQ,代码行数:12,代码来源:PartyMemberComparator.java

示例3: test_bond_withSearchByIssuer

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void test_bond_withSearchByIssuer() throws Exception {
  ZonedDateTime zdt = ZonedDateTime.parse("2011-01-31T12:00Z[Europe/London]");
  GovernmentBondSecurity sec1 = new GovernmentBondSecurity("US TREASURY N/B", "issuerType", "issuerDomicile", "market",
      Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALENT, new Expiry(zdt),
      "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCounts.ACT_ACT_ISDA,
      zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
  sec1.addExternalId(ExternalId.of("abc", "def"));
  SecurityDocument added1 = _secMaster.add(new SecurityDocument(sec1));
  GovernmentBondSecurity sec2 = new GovernmentBondSecurity("UK GOVT", "issuerType", "issuerDomicile", "market",
      Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALENT, new Expiry(zdt),
      "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCounts.ACT_ACT_ISDA,
      zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
  sec2.addExternalId(ExternalId.of("abc", "def"));
  SecurityDocument added2 = _secMaster.add(new SecurityDocument(sec2));
  
  SecurityDocument loaded1 = _secMaster.get(added1.getUniqueId());
  assertEquals(added1, loaded1);
  
  SecurityDocument loaded2 = _secMaster.get(added2.getUniqueId());
  assertEquals(added2, loaded2);
  
  BondSecuritySearchRequest request = new BondSecuritySearchRequest();
  request.setIssuerName("*TREASURY*");
  SecuritySearchResult result = _secMaster.search(request);
  assertEquals(1, result.getDocuments().size());
  assertEquals(loaded1, result.getFirstDocument());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:29,代码来源:DbSecurityMasterTest.java

示例4: test_bond_withSearchByIssuer

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void test_bond_withSearchByIssuer() throws Exception {
  ZonedDateTime zdt = ZonedDateTime.parse("2011-01-31T12:00Z[Europe/London]");
  GovernmentBondSecurity sec1 = new GovernmentBondSecurity("US TREASURY N/B", "issuerType", "issuerDomicile", "market",
      Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALENT, new Expiry(zdt),
      "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCounts.ACT_ACT_ISDA,
      zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
  sec1.addExternalId(ExternalId.of("abc", "def"));
  SecurityDocument added1 = _secMaster.add(new SecurityDocument(sec1));
  GovernmentBondSecurity sec2 = new GovernmentBondSecurity("UK GOVT", "issuerType", "issuerDomicile", "market",
      Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALENT, new Expiry(zdt),
      "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCounts.ACT_ACT_ISDA,
      zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
  sec2.addExternalId(ExternalId.of("abc", "def"));
  SecurityDocument added2 = _secMaster.add(new SecurityDocument(sec2));
  
  SecurityDocument loaded1 = _secMaster.get(added1.getUniqueId());
  assertEquals(added1, loaded1);
  
  SecurityDocument loaded2 = _secMaster.get(added2.getUniqueId());
  assertEquals(added2, loaded2);
  
  BondSecuritySearchRequest request = new BondSecuritySearchRequest();
  request.setIssuerName("*TREASURY*");
  SecuritySearchResult result = _secMaster.search(request);
  assertEquals(1, result.getDocuments().size());
  assertEquals(loaded1, result.getFirstDocument());
  
  BondSecuritySearchRequest request2 = new BondSecuritySearchRequest();
  request2.setIssuerName("*GOVT*");
  SecuritySearchResult result2 = _secMaster.search(request2);
  assertEquals(1, result2.getDocuments().size());
  assertEquals(loaded2, result2.getFirstDocument());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:35,代码来源:DbSecurityBeanMasterTest.java

示例5: testSerialization

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void testSerialization() {
    ZonedDateTime zonedDateTime = ZonedDateTime.parse("2010-08-20T10:43:46+08:00[Asia/Shanghai]");

    String json = gson.toJson(zonedDateTime);

    assertEquals(json, "\"2010-08-20T10:43:46+08:00[Asia/Shanghai]\"");
}
 
开发者ID:aaronhe42,项目名称:ThreeTen-Backport-Gson-Adapter,代码行数:9,代码来源:ZonedDateTimeConverterTest.java

示例6: getModelValue

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime getModelValue(String data) {
    if (TextUtils.isEmpty(data)) {
        return null;
    }
    return ZonedDateTime.parse(data);
}
 
开发者ID:jguerinet,项目名称:MyMartlet,代码行数:8,代码来源:ZonedDateTimeConverter.java

示例7: testSerialisation

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Tests that serialising to JSON works.
 */
@Test
public void testSerialisation() throws Exception
{
  final Gson gson = registerZonedDateTime(new GsonBuilder()).create();

  final ZonedDateTime zonedDateTime = ZonedDateTime.parse("1969-07-21T12:56:00+10:00[Australia/Brisbane]");
  final String json = gson.toJson(zonedDateTime);

  assertThat(json, is("\"1969-07-21T12:56:00+10:00[Australia/Brisbane]\""));
}
 
开发者ID:gkopff,项目名称:gson-threeten-serialisers,代码行数:14,代码来源:ZonedDateTimeConverterTest.java

示例8: convertToEntityProperty

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime convertToEntityProperty(String databaseValue) {
    return ZonedDateTime.parse(databaseValue);
}
 
开发者ID:netguru,项目名称:inbbbox-android,代码行数:5,代码来源:ZonedDateTimeConverter.java

示例9: deserialize

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
    return ZonedDateTime.parse(json.getAsString(), API_DATE_TIME_FORMAT);
}
 
开发者ID:netguru,项目名称:inbbbox-android,代码行数:5,代码来源:DateTimeConverter.java

示例10: convertFromString

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Expiry convertFromString(Class<? extends Expiry> cls, String str) {
  return new Expiry(ZonedDateTime.parse(str));
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:5,代码来源:JodaBeanConverters.java

示例11: deserializeZonedDateTime

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public static ZonedDateTime deserializeZonedDateTime(String serialized) {
    return ZonedDateTime.parse(serialized);
}
 
开发者ID:maskarade,项目名称:Android-Orma,代码行数:4,代码来源:TypeAdapters.java

示例12: RecordedBloombergLiveDataServer

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Creates an instance, parsing the given times from ISO-8601 strings.
 *  
 * @param rootTickPath  the recorded ticks directory
 * @param dataStart  the tick start time
 * @param dataEnd  the tick end time
 * @param referenceDataProvider  a source of reference data
 * @param cacheManager  the cache manager, not null
 */
public RecordedBloombergLiveDataServer(String rootTickPath, String dataStart, String dataEnd, ReferenceDataProvider referenceDataProvider, CacheManager cacheManager) {
  this(rootTickPath, ZonedDateTime.parse(dataStart), ZonedDateTime.parse(dataEnd), referenceDataProvider, cacheManager);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:RecordedBloombergLiveDataServer.java


注:本文中的org.threeten.bp.ZonedDateTime.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。