Java Code Examples for org.joda.time.LocalDateTime#toString()

The following examples show how to use org.joda.time.LocalDateTime#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java    From evt4j with MIT License 5 votes vote down vote up
public static DateTime getCorrectedTime(String referenceTime) {

        DateTime dateTime = new DateTime(referenceTime);

        // TODO: Dirty hack to sync local time
        DateTime local = new DateTime();
        LocalDateTime utc = local.withZone(DateTimeZone.UTC).toLocalDateTime();
        DateTime newLocal = new DateTime(utc.toString());
        // Dirty hack

        Duration diff = Duration.millis(dateTime.getMillis() + 70 - newLocal.getMillis());
        return dateTime.minus(diff);
    }
 
Example 2
Source File: TimeAwareRecursiveCopyableDataset.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
private boolean isDatePatternHourly(String datePattern) {
  DateTimeFormatter formatter = DateTimeFormat.forPattern(datePattern);
  LocalDateTime refDateTime = new LocalDateTime(2017, 01, 01, 10, 0, 0);
  String refDateTimeString = refDateTime.toString(formatter);
  LocalDateTime refDateTimeAtStartOfDay = refDateTime.withHourOfDay(0);
  String refDateTimeStringAtStartOfDay = refDateTimeAtStartOfDay.toString(formatter);
  return !refDateTimeString.equals(refDateTimeStringAtStartOfDay);
}
 
Example 3
Source File: TimeAwareRecursiveCopyableDataset.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
private boolean isDatePatternMinutely(String datePattern) {
  DateTimeFormatter formatter = DateTimeFormat.forPattern(datePattern);
  LocalDateTime refDateTime = new LocalDateTime(2017, 01, 01, 10, 59, 0);
  String refDateTimeString = refDateTime.toString(formatter);
  LocalDateTime refDateTimeAtStartOfHour = refDateTime.withMinuteOfHour(0);
  String refDateTimeStringAtStartOfHour = refDateTimeAtStartOfHour.toString(formatter);
  return !refDateTimeString.equals(refDateTimeStringAtStartOfHour);
}
 
Example 4
Source File: StringUtil.java    From AndroidAPS with GNU Affero General Public License v3.0 4 votes vote down vote up
public static String toDateTimeString(LocalDateTime localDateTime) {
    return localDateTime.toString("dd.MM.yyyy HH:mm:ss");
}
 
Example 5
Source File: ResourceDAO.java    From SI with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected String getTimeString(LocalDateTime time) {
	// return time.toString("yyyyMMddTHHmmss");
	return time.toString(DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss"));
}
 
Example 6
Source File: ResourceDAO.java    From SI with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected String getTimeString(LocalDateTime time) {
	// return time.toString("yyyyMMddTHHmmss");
	return time.toString(DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss"));
}
 
Example 7
Source File: FmtLocalDateTime.java    From super-csv with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected String format(final LocalDateTime jodaType,
		final DateTimeFormatter formatter) {
	return jodaType.toString(formatter);
}
 
Example 8
Source File: FmtLocalDateTime.java    From super-csv with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected String format(final LocalDateTime jodaType, final String pattern,
		final Locale locale) {
	return jodaType.toString(pattern, locale);
}
 
Example 9
Source File: FmtLocalDateTime.java    From super-csv with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected String format(final LocalDateTime jodaType) {
	return jodaType.toString();
}
 
Example 10
Source File: TimestampColumnLocalDateTimeMapper.java    From jadira with Apache License 2.0 4 votes vote down vote up
@Override
public String toNonNullString(LocalDateTime value) {
    return value.toString();
}