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

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

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

LocalDateTime.parse介绍

[英]Parses a LocalDateTime from the specified string.

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

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

public ISODateTime (String s) {
    ldt = LocalDateTime.parse(s);        
  }
}

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

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

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

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

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

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

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

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

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

LocalDate localDate;
if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalDate();
} else {
LocalTime localDate;
if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalTime();
} else {

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

LocalDate localDate;
if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalDate();
} else {
LocalTime localDate;
if (text.length() == 23) {
  LocalDateTime localDateTime = LocalDateTime.parse(text);
  localDate = localDateTime.toLocalTime();
} else {

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

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

代码示例来源:origin: org.apache.isis.core/isis-core-applib

public LocalDateTime getParameterAsLocalDateTime(final String parameterName) {
  final String value = getParameter(parameterName);
  if (value == null) {
    return null;
  }
  return LocalDateTime.parse(value);
}

代码示例来源:origin: movsim/movsim

public static double convertToSeconds(String time, String timeFormat, long timeOffsetMillis) {
    if (timeFormat.isEmpty()) {
      return Double.parseDouble(time) - timeOffsetMillis / 1000.;
    }

    DateTime dateTime = LocalDateTime.parse(time, DateTimeFormat.forPattern(timeFormat)).toDateTime(DateTimeZone.UTC);

    double timeInSeconds = (dateTime.getMillis() - timeOffsetMillis) / 1000.;
    LOG.debug("time={} --> dateTime={} --> seconds with offset=" + timeInSeconds, time, dateTime);
    return timeInSeconds;
  }
}

代码示例来源:origin: movsim/movsim

private DateTime convertToDateTime(String time) {
  if (timeInputPattern.equalsIgnoreCase("1")) {
    return DateTime.now(DateTimeZone.UTC);
  }
  DateTime dateTime = LocalDateTime.parse(time, DateTimeFormat.forPattern(timeInputPattern)).toDateTime(
      DateTimeZone.UTC);
  LOG.debug("{} --> {}", time, dateTime);
  return dateTime;
}

代码示例来源:origin: de.digitalcollections.commons/dc-commons-yaml

@Override
 public Object construct(Node node) {
  ScalarNode scalarNode = (ScalarNode) node;
  return LocalDateTime.parse(scalarNode.getValue());
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

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

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

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

代码示例来源:origin: redfish64/TinyTravelTracker

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

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

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

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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

代码示例来源:origin: dremio/dremio-oss

public void eval() {

   byte[] buf = new byte[in.end - in.start];
   in.buffer.getBytes(in.start, buf, 0, in.end - in.start);
   String input = new String(buf, com.google.common.base.Charsets.UTF_8);

   try {
    org.joda.time.format.DateTimeFormatter f = org.apache.arrow.vector.util.DateUtility.getDateTimeFormatter();
    out.value = com.dremio.common.util.DateTimes.toMillis(org.joda.time.LocalDateTime.parse(input, f));

   } catch (RuntimeException e) {
    throw errCtx.error(e)
     .build();
   }

 }
}

代码示例来源:origin: dremio/dremio-oss

public void eval() {

   byte[] buf = new byte[in.end - in.start];
   in.buffer.getBytes(in.start, buf, 0, in.end - in.start);
   String input = new String(buf, com.google.common.base.Charsets.UTF_8);

   try {
    org.joda.time.format.DateTimeFormatter f = org.apache.arrow.vector.util.DateUtility.getDateTimeFormatter();
    out.value = com.dremio.common.util.DateTimes.toMillis(org.joda.time.LocalDateTime.parse(input, f));

   } catch (RuntimeException e) {
    throw errCtx.error(e)
     .build();
   }

 }
}

代码示例来源:origin: com.synaptix.toast/toast-tk-adapters

/**
 * Returns a LocalDateTime from a string in format "dd/MM/yyyy HH:mm:ss"
 */
public static LocalDateTime parseLocalDateTimeFromString(String dateTime) {
  if (isEmptyOrNull(dateTime)) {
    return null;
  }
  return LocalDateTime.parse(dateTime, new DateTimeFormatterBuilder().appendPattern(DateTimePattern).toFormatter());
}

相关文章