Examples of parseDateTime()


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

    public void testConversion() {
        String input = "21/Jan/2012:02:34:42 +0100";
        String pattern = "dd/MMM/yyyy:HH:mm:ss Z";
       
        DateTimeFormatter dtf = DateTimeFormat.forPattern(pattern);
        DateTime actual = dtf.parseDateTime(input);
       
        DateTime expected = new DateTime(2012, 1, 21, 2, 34, 42, DateTimeZone.forOffsetHours(1));
        Assert.assertTrue(expected.isEqual(actual));
    }
}
View Full Code Here

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

   
    DateTime dateTime = new DateTime();
   
    if (dateTimeString != null) {
      DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(dateFormatPattern);
      dateTime = dateTimeFormatter.parseDateTime(dateTimeString);
    }
     
    return dateTime;
   
  }
View Full Code Here

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

        }
        else {
            formatter = DATE_FORMAT; // "yyyy-MM-dd"
        }

        return formatter.parseDateTime(stamp);
    }

    /**
     *
     * @param time
View Full Code Here

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

     * @param time
     * @return
     */
    public static DateTime toTime(String time) {
        DateTimeFormatter formatter = time.contains(" ") ? DATE_TIME_FORMAT : (time.contains("T") ? TIMESTAMP_FORMAT : DATE_FORMAT);
        return formatter.parseDateTime(time);
    }

    /**
     *
     * @param runtime
View Full Code Here

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

            facet.setEstimatedCalories(day.getInt("estimatedCalories"));
            facet.setPredictedCalories(day.getInt("predictedCalories"));
            facet.json = day.getString("minutes");
            facet.lastSync = d.getMillis();

            DateTime date = formatter.parseDateTime(day.getString("date"));
            facet.date = TimeUtils.dateFormatter.print(date.getMillis());

            long fromMidnight = TimeUtils.fromMidnight(date.getMillis(), timeZone.toTimeZone());
            long toMidnight = TimeUtils.toMidnight(date.getMillis(), timeZone.toTimeZone());
            //Sets the start and end times for the facet so that it can be uniquely defined
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()

        return this.authenticationTime;
    }

    public void setAuthenticationTime(String authenticationTimeStr) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyy-MM-dd'T'HH:mm:ss'Z'");
        DateTime dateTime = dateTimeFormatter.parseDateTime(authenticationTimeStr);
        this.authenticationTime = dateTime.withZoneRetainFields(DateTimeZone.UTC).toDate();
    }

    void setPhishingResistant(boolean phishingResistant) {
        this.phishingResistant = phishingResistant;
View Full Code Here

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

    @Override
    public DateTime unmarshal(String dateTimeStr) throws Exception {
        DateTimeFormatter fmt = DateTimeFormat
                .forPattern("dd-MM-yyyy HH:mm:ss.SSS");
        return fmt.parseDateTime(dateTimeStr);
    }

}
View Full Code Here

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

    }

    @Override
    public LocalDate unmarshal(String dateStr) throws Exception {
        final DateTimeFormatter fmt = DateTimeFormat.forPattern("dd-MM-yyyy");
        return fmt.parseDateTime(dateStr).toLocalDate();
    }

}
View Full Code Here

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

        // eg. basic: 20080909, full: 2008-09-09T12:21:00 etc
        // convert everything to UTC so that we remove any timezone
        // problems
        try {
            DateTime idt = parseBasicOrFullDateTime(input1);
            odt1 = dto.parseDateTime(idt.toString()).withZone(
                    DateTimeZone.forID("UTC"));
            odt = odt1.toString();

        } catch (Exception e) {
            e.printStackTrace();
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.