Package org.joda.time.format

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


   public static String getDifferenceToNow(String utc) {
     if (utc == null) return "";
     utc = ReplaceVariable.replaceAll(utc, " ", "T");
     DateTime now = new DateTime();
     DateTimeFormatter f = ISODateTimeFormat.dateTimeParser();
     DateTime other = f.parseDateTime(utc);
     Period period = new Period(other, now); // Period(ReadableInstant startInstant, ReadableInstant endInstant)
     return period.toString();
   }

   /**
 
View Full Code Here


        if (field == null) {
            throw new RuntimeException("Document has no field timestamp.");
        }

        DateTimeFormatter formatter = DateTimeFormat.forPattern(ES_DATE_FORMAT).withZoneUTC();
        DateTime dt = formatter.parseDateTime(field.toString());

        return (int) (dt.getMillis()/1000);
    }

    public static DateTime iso8601() {
View Full Code Here

  @Override
  protected void respond(AjaxRequestTarget target) {
    Request r = target.getPage().getRequest();
    ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString());
    DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(DateTimeZone.UTC);
    DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
      .toDateMidnight();
    DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
      .toDateMidnight();
    DateMidnight visibleStart = fmt.parseDateTime(
      r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
View Full Code Here

    Request r = target.getPage().getRequest();
    ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString());
    DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(DateTimeZone.UTC);
    DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
      .toDateMidnight();
    DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
      .toDateMidnight();
    DateMidnight visibleStart = fmt.parseDateTime(
      r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
    DateMidnight visibleEnd = fmt
      .parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight();
View Full Code Here

    DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(DateTimeZone.UTC);
    DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString())
      .toDateMidnight();
    DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
      .toDateMidnight();
    DateMidnight visibleStart = fmt.parseDateTime(
      r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
    DateMidnight visibleEnd = fmt
      .parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight();
    View view = new View(type, start, end, visibleStart, visibleEnd);
    CalendarResponse response = new CalendarResponse(getCalendar(), target);
View Full Code Here

      .toDateMidnight();
    DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString())
      .toDateMidnight();
    DateMidnight visibleStart = fmt.parseDateTime(
      r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight();
    DateMidnight visibleEnd = fmt
      .parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight();
    View view = new View(type, start, end, visibleStart, visibleEnd);
    CalendarResponse response = new CalendarResponse(getCalendar(), target);
    onViewDisplayed(view, response);
  }
View Full Code Here

     *            an ISO8601 formatted String (non millis)
     * @return a DateTime instance at midnight in "Market time"
     */
    public static DateTime isoDayToDateTime(final String day) {
        final DateTimeFormatter fmt = isoFormat.withZone(marketTimeZone);
        final DateTime parsed = fmt.parseDateTime(day);
        // set to start of day
        final DateTime result = parsed.withMillisOfDay(0);
        return result;
    }

View Full Code Here

        // Import the data
        int count = 0;
        while ((nextLine = csvReader.readNext()) != null) {
            // The first value is always a date.
            long time = dtf.parseDateTime(nextLine[0]).getMillis();

            // The rest of the values are point samples.
            for (int i = 1; i < nextLine.length; i++) {
                DataValue value = DataValue.stringToValue(nextLine[i], vos[i - 1].getPointLocator().getDataTypeId());
                PointValueTime pvt = new PointValueTime(value, time);
View Full Code Here

      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

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.