本文整理了Java中org.joda.time.format.DateTimeFormatter.getParser()
方法的一些代码示例,展示了DateTimeFormatter.getParser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTimeFormatter.getParser()
方法的具体详情如下:
包路径:org.joda.time.format.DateTimeFormatter
类名称:DateTimeFormatter
方法名:getParser
[英]Gets the internal parser object that performs the real parsing work.
[中]获取执行实际解析工作的内部解析器对象。
代码示例来源:origin: joda-time/joda-time
private static DateTimeFormatter timeParser() {
if (tp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.appendOptional(offsetElement().getParser())
.toFormatter();
}
return tp;
}
代码示例来源:origin: JodaOrg/joda-time
private static DateTimeFormatter timeParser() {
if (tp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.appendOptional(offsetElement().getParser())
.toFormatter();
}
return tp;
}
代码示例来源:origin: apache/hive
public TimestampParser(String[] formatStrings) {
this.formatStrings = formatStrings;
// create formatter that includes all of the input patterns
if (formatStrings != null && formatStrings.length > 0) {
DateTimeParser[] parsers = new DateTimeParser[formatStrings.length];
for (int idx = 0; idx < formatStrings.length; ++idx) {
String formatString = formatStrings[idx];
if (formatString.equalsIgnoreCase(millisFormatString)) {
// Use milliseconds parser if pattern matches our special-case millis pattern string
parsers[idx] = new MillisDateFormatParser();
} else {
parsers[idx] = DateTimeFormat.forPattern(formatString).getParser();
}
}
fmt = new DateTimeFormatterBuilder()
.append(null, parsers)
.toFormatter()
.withDefaultYear(1970);
}
}
代码示例来源:origin: joda-time/joda-time
private static DateTimeFormatter dateTimeParser() {
if (dtp == null) {
// This is different from the general time parser in that the 'T'
// is required.
DateTimeParser time = new DateTimeFormatterBuilder()
.appendLiteral('T')
.append(timeElementParser())
.appendOptional(offsetElement().getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(null, new DateTimeParser[] {time, dateOptionalTimeParser().getParser()})
.toFormatter();
}
return dtp;
}
代码示例来源:origin: joda-time/joda-time
private static DateTimeFormatter dateOptionalTimeParser() {
if (dotp == null) {
DateTimeParser timeOrOffset = new DateTimeFormatterBuilder()
.appendLiteral('T')
.appendOptional(timeElementParser().getParser())
.appendOptional(offsetElement().getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(dateElementParser())
.appendOptional(timeOrOffset)
.toFormatter();
}
return dotp;
}
代码示例来源:origin: JodaOrg/joda-time
private static DateTimeFormatter dateTimeParser() {
if (dtp == null) {
// This is different from the general time parser in that the 'T'
// is required.
DateTimeParser time = new DateTimeFormatterBuilder()
.appendLiteral('T')
.append(timeElementParser())
.appendOptional(offsetElement().getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(null, new DateTimeParser[] {time, dateOptionalTimeParser().getParser()})
.toFormatter();
}
return dtp;
}
代码示例来源:origin: JodaOrg/joda-time
private static DateTimeFormatter dateOptionalTimeParser() {
if (dotp == null) {
DateTimeParser timeOrOffset = new DateTimeFormatterBuilder()
.appendLiteral('T')
.appendOptional(timeElementParser().getParser())
.appendOptional(offsetElement().getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(dateElementParser())
.appendOptional(timeOrOffset)
.toFormatter();
}
return dotp;
}
代码示例来源:origin: joda-time/joda-time
private static DateTimeFormatter localTimeParser() {
if (ltp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.toFormatter().withZoneUTC();
}
return ltp;
}
代码示例来源:origin: JodaOrg/joda-time
private static DateTimeFormatter localTimeParser() {
if (ltp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.toFormatter().withZoneUTC();
}
return ltp;
}
代码示例来源:origin: apache/incubator-druid
.appendOptional(ISODateTimeFormat.timeElementParser().getParser())
.appendOptional(offsetElement.getParser())
.toParser();
代码示例来源:origin: apache/incubator-druid
private static DateTimeFormatter createAutoParser()
{
final DateTimeFormatter offsetElement = new DateTimeFormatterBuilder()
.appendTimeZoneOffset("Z", true, 2, 4)
.toFormatter();
DateTimeParser timeOrOffset = new DateTimeFormatterBuilder()
.append(
null,
new DateTimeParser[]{
new DateTimeFormatterBuilder().appendLiteral('T').toParser(),
new DateTimeFormatterBuilder().appendLiteral(' ').toParser()
}
)
.appendOptional(ISODateTimeFormat.timeElementParser().getParser())
.appendOptional(offsetElement.getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(ISODateTimeFormat.dateElementParser())
.appendOptional(timeOrOffset)
.toFormatter();
}
}
代码示例来源:origin: apache/hive
private static DateTimeFormatter createAutoParser() {
final DateTimeFormatter
offsetElement =
new DateTimeFormatterBuilder().appendTimeZoneOffset("Z", true, 2, 4).toFormatter();
DateTimeParser
timeOrOffset =
new DateTimeFormatterBuilder().append(null,
new DateTimeParser[] {new DateTimeFormatterBuilder().appendLiteral('T').toParser(),
new DateTimeFormatterBuilder().appendLiteral(' ').toParser()})
.appendOptional(ISODateTimeFormat.timeElementParser().getParser())
.appendOptional(offsetElement.getParser())
.toParser();
return new DateTimeFormatterBuilder().append(ISODateTimeFormat.dateElementParser())
.appendOptional(timeOrOffset)
.toFormatter();
}
}
代码示例来源:origin: joda-time/joda-time
private static DateTimeFormatter dateElementParser() {
if (dpe == null) {
return new DateTimeFormatterBuilder()
.append(null, new DateTimeParser[] {
new DateTimeFormatterBuilder()
.append(yearElement())
.appendOptional
(new DateTimeFormatterBuilder()
.append(monthElement())
.appendOptional(dayOfMonthElement().getParser())
.toParser())
.toParser(),
new DateTimeFormatterBuilder()
.append(weekyearElement())
.append(weekElement())
.appendOptional(dayOfWeekElement().getParser())
.toParser(),
new DateTimeFormatterBuilder()
.append(yearElement())
.append(dayOfYearElement())
.toParser()
})
.toFormatter();
}
return dpe;
}
代码示例来源:origin: JodaOrg/joda-time
private static DateTimeFormatter dateElementParser() {
if (dpe == null) {
return new DateTimeFormatterBuilder()
.append(null, new DateTimeParser[] {
new DateTimeFormatterBuilder()
.append(yearElement())
.appendOptional
(new DateTimeFormatterBuilder()
.append(monthElement())
.appendOptional(dayOfMonthElement().getParser())
.toParser())
.toParser(),
new DateTimeFormatterBuilder()
.append(weekyearElement())
.append(weekElement())
.appendOptional(dayOfWeekElement().getParser())
.toParser(),
new DateTimeFormatterBuilder()
.append(yearElement())
.append(dayOfYearElement())
.toParser()
})
.toFormatter();
}
return dpe;
}
代码示例来源:origin: h2oai/h2o-2
break;
case 'e':
builder.appendOptional(DateTimeFormat.forPattern("' '").getParser());
builder.appendDayOfMonth(2);
break;
break;
case 'k':
builder.appendOptional(DateTimeFormat.forPattern("' '").getParser());
builder.appendHourOfDay(2);
break;
case 'l':
builder.appendOptional(DateTimeFormat.forPattern("' '").getParser());
builder.appendClockhourOfHalfday(2);
break;
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Appends another formatter.
*
* @param formatter the formatter to add
* @return this DateTimeFormatterBuilder, for chaining
* @throws IllegalArgumentException if formatter is null or of an invalid type
*/
public DateTimeFormatterBuilder append(DateTimeFormatter formatter) {
if (formatter == null) {
throw new IllegalArgumentException("No formatter supplied");
}
return append0(formatter.getPrinter(), formatter.getParser());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public int parseInto(DateTimeParserBucket bucket, String text, int position) {
DateTimeParser p = getFormatter(bucket.getLocale()).getParser();
return p.parseInto(bucket, text, position);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private static DateTimeFormatter timeParser() {
if (tp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.appendOptional(offsetElement().getParser())
.toFormatter();
}
return tp;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private static DateTimeFormatter dateOptionalTimeParser() {
if (dotp == null) {
DateTimeParser timeOrOffset = new DateTimeFormatterBuilder()
.appendLiteral('T')
.appendOptional(timeElementParser().getParser())
.appendOptional(offsetElement().getParser())
.toParser();
return new DateTimeFormatterBuilder()
.append(dateElementParser())
.appendOptional(timeOrOffset)
.toFormatter();
}
return dotp;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private static DateTimeFormatter localTimeParser() {
if (ltp == null) {
return new DateTimeFormatterBuilder()
.appendOptional(literalTElement().getParser())
.append(timeElementParser())
.toFormatter().withZoneUTC();
}
return ltp;
}
内容来源于网络,如有侵权,请联系作者删除!