org.joda.time.LocalDate.parse()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(219)

本文整理了Java中org.joda.time.LocalDate.parse()方法的一些代码示例,展示了LocalDate.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.parse()方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:parse

LocalDate.parse介绍

[英]Parses a LocalDate from the specified string.

This uses ISODateTimeFormat#localDateParser().
[中]从指定的字符串解析LocalDate。
这将使用ISODateTimeFormat#localDateParser()。

代码示例

代码示例来源:origin: alibaba/fastjson

LocalDate.parse(text) //
: LocalDate.parse(text, formatter);

代码示例来源:origin: joda-time/joda-time

/**
 * Parses a {@code LocalDate} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static LocalDate parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Parses a {@code LocalDate} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static LocalDate parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: com.alibaba/fastjson

LocalDate.parse(text) //
: LocalDate.parse(text, formatter);

代码示例来源:origin: prestodb/presto

@Override
public long getLong(int field)
{
  checkState(row != null, "No current row");
  Column column = columns.get(field);
  if (column.getType().getBase() == ColumnType.Base.DATE) {
    return Days.daysBetween(new LocalDate(0), LocalDate.parse(row.get(column.getPosition()))).getDays();
  }
  if (column.getType().getBase() == ColumnType.Base.TIME) {
    return LocalTime.parse(row.get(column.getPosition())).getMillisOfDay();
  }
  if (column.getType().getBase() == ColumnType.Base.INTEGER) {
    return parseInt(row.get(column.getPosition()));
  }
  if (column.getType().getBase() == ColumnType.Base.DECIMAL) {
    DecimalParseResult decimalParseResult = Decimals.parse(row.get(column.getPosition()));
    return rescale((Long) decimalParseResult.getObject(), decimalParseResult.getType().getScale(), ((DecimalType) columnTypes.get(field)).getScale());
  }
  return parseLong(row.get(column.getPosition()));
}

代码示例来源:origin: apache/flink

addr,
ByteBuffer.wrap(b),
LocalDate.parse("2014-03-01"),
LocalTime.parse("12:12:12"),
123456,

代码示例来源:origin: apache/flink

public static User generateRandomUser(Random rnd) {
  return new User(
      generateRandomString(rnd, 50),
      rnd.nextBoolean() ? null : rnd.nextInt(),
      rnd.nextBoolean() ? null : generateRandomString(rnd, 6),
      rnd.nextBoolean() ? null : rnd.nextLong(),
      rnd.nextDouble(),
      null,
      rnd.nextBoolean(),
      generateRandomStringList(rnd, 20, 30),
      generateRandomBooleanList(rnd, 20),
      rnd.nextBoolean() ? null : generateRandomStringList(rnd, 20, 20),
      generateRandomColor(rnd),
      new HashMap<>(),
      generateRandomFixed16(rnd),
      generateRandomUnion(rnd),
      generateRandomAddress(rnd),
      generateRandomBytes(rnd),
      LocalDate.parse("2014-03-01"),
      LocalTime.parse("12:12:12"),
      123456,
      DateTime.parse("2014-03-01T12:12:12.321Z"),
      123456L,
      ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()),
      new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()));
}

代码示例来源:origin: apache/flink

@Override
  public User map(Tuple3<String, Integer, String> value) {
    User user = new User();
    user.setName(value.f0);
    user.setFavoriteNumber(value.f1);
    user.setFavoriteColor(value.f2);
    user.setTypeBoolTest(true);
    user.setTypeArrayString(Collections.emptyList());
    user.setTypeArrayBoolean(Collections.emptyList());
    user.setTypeEnum(Colors.BLUE);
    user.setTypeMap(Collections.emptyMap());
    user.setTypeBytes(ByteBuffer.allocate(10));
    user.setTypeDate(LocalDate.parse("2014-03-01"));
    user.setTypeTimeMillis(LocalTime.parse("12:12:12"));
    user.setTypeTimeMicros(123456);
    user.setTypeTimestampMillis(DateTime.parse("2014-03-01T12:12:12.321Z"));
    user.setTypeTimestampMicros(123456L);
    // 20.00
    user.setTypeDecimalBytes(ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()));
    // 20.00
    user.setTypeDecimalFixed(new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()));
    return user;
  }
}

代码示例来源:origin: apache/flink

private void output(final AvroOutputFormat<User> outputFormat) throws IOException {
  outputFormat.configure(new Configuration());
  outputFormat.open(1, 1);
  for (int i = 0; i < 100; i++) {
    User user = new User();
    user.setName("testUser");
    user.setFavoriteNumber(1);
    user.setFavoriteColor("blue");
    user.setTypeBoolTest(true);
    user.setTypeArrayString(Collections.emptyList());
    user.setTypeArrayBoolean(Collections.emptyList());
    user.setTypeEnum(Colors.BLUE);
    user.setTypeMap(Collections.emptyMap());
    user.setTypeBytes(ByteBuffer.allocate(10));
    user.setTypeDate(LocalDate.parse("2014-03-01"));
    user.setTypeTimeMillis(LocalTime.parse("12:12:12"));
    user.setTypeTimeMicros(123456);
    user.setTypeTimestampMillis(DateTime.parse("2014-03-01T12:12:12.321Z"));
    user.setTypeTimestampMicros(123456L);
    // 20.00
    user.setTypeDecimalBytes(ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()));
    // 20.00
    user.setTypeDecimalFixed(new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()));
    outputFormat.writeRecord(user);
  }
  outputFormat.close();
}

代码示例来源:origin: apache/flink

user1.setTypeNested(addr);
user1.setTypeBytes(ByteBuffer.allocate(10));
user1.setTypeDate(LocalDate.parse("2014-03-01"));
user1.setTypeTimeMillis(LocalTime.parse("12:12:12"));
user1.setTypeTimeMicros(123456);
            .build())
    .setTypeBytes(ByteBuffer.allocate(10))
    .setTypeDate(LocalDate.parse("2014-03-01"))
    .setTypeTimeMillis(LocalTime.parse("12:12:12"))
    .setTypeTimeMicros(123456)

代码示例来源:origin: apache/flink

user1.setTypeNested(addr);
user1.setTypeBytes(ByteBuffer.allocate(10));
user1.setTypeDate(LocalDate.parse("2014-03-01"));
user1.setTypeTimeMillis(LocalTime.parse("12:12:12"));
user1.setTypeTimeMicros(123456);
            .build())
    .setTypeBytes(ByteBuffer.allocate(10))
    .setTypeDate(LocalDate.parse("2014-03-01"))
    .setTypeTimeMillis(LocalTime.parse("12:12:12"))
    .setTypeTimeMicros(123456)
  user.setTypeNested(address);
  user.setTypeBytes(ByteBuffer.allocate(10));
  user.setTypeDate(LocalDate.parse("2014-03-01"));
  user.setTypeTimeMillis(LocalTime.parse("12:12:12"));
  user.setTypeTimeMicros(123456);

代码示例来源:origin: apache/flink

user.put("type_nested", addr);
user.put("type_bytes", ByteBuffer.allocate(10));
user.put("type_date", LocalDate.parse("2014-03-01"));
user.put("type_time_millis", LocalTime.parse("12:12:12"));
user.put("type_time_micros", 123456);

代码示例来源:origin: apache/flink

.setTypeNested(addr)
.setTypeBytes(ByteBuffer.allocate(10))
.setTypeDate(LocalDate.parse("2014-03-01"))
.setTypeTimeMillis(LocalTime.parse("12:12:12"))
.setTypeTimeMicros(123456)

代码示例来源:origin: spring-projects/spring-framework

assertEquals(LocalDate.parse("2009-10-31").toDate(), handler.date);
assertEquals(Double.valueOf(0.9999), handler.percent);

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Parses a {@code LocalDate} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static LocalDate parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: com.ning.billing/killbill-jaxrs

private LocalDate extractLocalDate(final String inputDate) {
    if (inputDate != null) {
      try {
        final LocalDate localDate = LocalDate.parse(inputDate, LOCAL_DATE_FORMATTER);
        return localDate;
      } catch (IllegalArgumentException expectedAndIgnore) {
      }
    }
    return null;
  }
}

代码示例来源:origin: org.incode.module.base/incode-module-base-dom

/**
 * Parse a string to a LocalDate
 * 
 * @param input  a string representing a parsable LocalDate, "*" or "----------" returns null
 * @return
 */
private static LocalDate parseLocalDate(final String input) {
  if (input.contains("--") || input.contains("*")) {
    return null;
  }
  return LocalDate.parse(input);
}

代码示例来源:origin: smarek/Simple-Dilbert

public static LocalDate extractCurrentDateFromIntentUrl(Uri path) {
    try {
      Matcher m = date_match_pattern.matcher(path.toString());
      if (m.matches()) {
        return LocalDate.parse(m.group(1), DilbertPreferences.DATE_FORMATTER);
      }
    } catch (Throwable t) {
      Log.e(LOG_TAG, "extractCurrentDateFromIntentUrl failed", t);
    }
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Parses a {@code LocalDate} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static LocalDate parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Parses a {@code LocalDate} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static LocalDate parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

相关文章