Examples of parseDateTime()


Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

    Object constant = node.getState();
    if (info.isJodaType()) {
      DateTimeFormatter fmt;
      if (info.getClassType().getName().equals("org.joda.time.DateTime")) {
        fmt = ISODateTimeFormat.dateTime();
        DateTime dateTime = fmt.parseDateTime(constant.toString());
        return StandardConverters.convertToBytes(dateTime);
      } else if (info.getClassType().getName().equals("org.joda.time.LocalDateTime")) {
        fmt = ISODateTimeFormat.dateTime();
        LocalDateTime localDateTime = fmt.parseLocalDateTime(constant.toString());
        return StandardConverters.convertToBytes(localDateTime);
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

        // See http://joda-time.sourceforge.net/api-release/org/joda/time/format/DateTimeFormat.html
        DateTimeFormatter parser = DateTimeFormat.forPattern(format);
        DateTime result;
        try {
            result = parser.parseDateTime(date);
        } catch(Exception e) {
            return null;
        }

        return result.toString();
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

        //DateTimeZone dtz = extractDateTimeZone(dtStr);
        //The timezone in the customized format is not predictable
        DateTimeFormatter dtf = DateTimeFormat.forPattern(DataType
                .toString(input.get(1)));
        //if (dtz == null) {
            return dtf.parseDateTime(dtStr);
        //} else {
        //    return dtf.withZone(dtz).parseDateTime(dtStr);
        //}
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

    }
    else
    {
      try
      {
        DateTime date = format.parseDateTime(value);
        return date.toDate();
      }
      catch (RuntimeException e)
      {
        throw new ConversionException(e);
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

    private ModelUtil() {}

    public static Date stringToDate(String dateString){
        DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
        return fmt.parseDateTime(dateString).toDate();
    }

    public static String dateToString(Date date){
        DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
        DateTime dateTime = new DateTime(date);
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

        //DateTimeZone dtz = extractDateTimeZone(dtStr);
        //The timezone in the customized format is not predictable
        DateTimeFormatter dtf = DateTimeFormat.forPattern(DataType
                .toString(input.get(1)));
        //if (dtz == null) {
            return dtf.parseDateTime(dtStr);
        //} else {
        //    return dtf.withZone(dtz).parseDateTime(dtStr);
        //}
    }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

        // See http://joda-time.sourceforge.net/api-release/org/joda/time/format/DateTimeFormat.html
        DateTimeFormatter parser = DateTimeFormat.forPattern(format);
        DateTime result;
        try {
            result = parser.parseDateTime(date);
        } catch(Exception e) {
            return null;
        }

        return result.toString();
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

    }
    else
    {
      try
      {
        DateTime date = format.parseDateTime(value);
        return date.toDate();
      }
      catch (RuntimeException e)
      {
        throw new ConversionException(e);
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

   * @param dateStr date str
   * @return datetime
   */
  public DateTime toDateTime(String dateStr) {
    DateTimeFormatter df = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
    DateTime date = df.parseDateTime(dateStr);
    return date;
  }

  public DateTime toDateTime(String dateStr, String format) {
    if (ValidateUtils.me().isNullOrEmpty(format)) {
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()

  public DateTime toDateTime(String dateStr, String format) {
    if (ValidateUtils.me().isNullOrEmpty(format)) {
      format = "yyyy-MM-dd HH:mm:ss";
    }
    DateTimeFormatter df = DateTimeFormat.forPattern(format);
    DateTime date = df.parseDateTime(dateStr);
    return date;
  }

  /**
   * 时间转换为字符串
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.