Package org.joda.time.format

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


      format = format.withZone(getTimeZone());

      try
      {
        // parse date retaining the time of the submission
        dateTime = format.parseDateTime(value);
      }
      catch (RuntimeException e)
      {
        throw new ConversionException(e);
      }
View Full Code Here


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

        // 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

              dateString.length() - 4).trim();
          formatter = FORMATTER_TIMEZONE;
        }
      }
      DateTimeZone.setDefault(DateTimeZone.UTC);
      DateTime dt = formatter.parseDateTime(dateString);
      return dt.toDate();
    } catch (IllegalArgumentException e) {
      throw new ParseException(e.getLocalizedMessage(), 0);
    }
  }
View Full Code Here

     */
    public static Date getDate(String date, String pattern)
            throws IllegalArgumentException {
        DateTimeFormatter formatter =
                DateTimeFormat.forPattern(pattern);
        return formatter.parseDateTime(date).toDate();
    }

    /**
     * Check if date difference is within given days.
     *
 
View Full Code Here

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

    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

        DateTimeUtils.setCurrentMillisSystem();
    }

    private void setToFormat() {
        DateTimeFormatter fmt = DateTimeFormat.forPattern(joda.format().pattern());
        DateTime dt = fmt.parseDateTime(joda.timestamp());
        DateTimeUtils.setCurrentMillisFixed(dt.getMillis());

    }

    private void setToIso() {
View Full Code Here

    }

    private void setToIso() {
        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
        DateTime dt = fmt.parseDateTime(joda.timestamp());
        DateTimeUtils.setCurrentMillisFixed(dt.getMillis());
    }

    private void setByMillis() {
        DateTimeUtils.setCurrentMillisFixed(joda.value());
View Full Code Here

        }
        String date = rawDate.toString();       
        if (date.equals("0"))
            return null;
        DateTimeFormatter parser = DateTimeFormat.forPattern(format);
        DateTime result          = parser.parseDateTime(date);
        return result.getMillis();
    }
}
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.