本文整理汇总了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);
}
}
}
示例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;
}
}
示例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());
}
示例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());
}
示例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]\"");
}
示例6: getModelValue
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime getModelValue(String data) {
if (TextUtils.isEmpty(data)) {
return null;
}
return ZonedDateTime.parse(data);
}
示例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]\""));
}
示例8: convertToEntityProperty
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public ZonedDateTime convertToEntityProperty(String databaseValue) {
return ZonedDateTime.parse(databaseValue);
}
示例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);
}
示例10: convertFromString
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
public Expiry convertFromString(Class<? extends Expiry> cls, String str) {
return new Expiry(ZonedDateTime.parse(str));
}
示例11: deserializeZonedDateTime
import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
public static ZonedDateTime deserializeZonedDateTime(String serialized) {
return ZonedDateTime.parse(serialized);
}
示例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);
}