Package org.joda.time.format

Examples of org.joda.time.format.DateTimeFormatter


    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDate date = (LocalDate) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateUtil.titleString(f, date);
    }
View Full Code Here


    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDateTime dateTime = (LocalDateTime) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateTimeUtil.titleString(f, dateTime);
    }
View Full Code Here

        }

        if(_props.containsKey("output.path")) {
            String location = _props.get("output.path");
            if(location.endsWith("#CURRENT")) {
                DateTimeFormatter format = DateTimeFormat.forPattern(COMMON_FILE_DATE_PATTERN);
                String destPath = format.print(new DateTime());
                location = location.substring(0, location.length() - "#CURRENT".length())
                           + destPath;
                System.out.println("Store location set to " + location);
            }
View Full Code Here

    public String formatDateTime(DateTime date) {
        return formatDate(date, "MM-dd-yyyy HH:mm:ss");
    }

    public String formatDate(DateTime date, String format) {
        DateTimeFormatter f = DateTimeFormat.forPattern(format);
        return f.print(date);
    }
View Full Code Here

    } else {
      try {
        MapMessage report = ActiveMQDirector.getSession().createMapMessage();

        DateTime now = new DateTime();
        DateTimeFormatter iso8601formatter = ISODateTimeFormat.dateTime();
        report.setString("timestamp", iso8601formatter.print(now));
        report.setString("queue", queueName);
        report.setString("id", id);
        report.setString("level", level.toLowerCase());
        if (message != null)
          report.setString("message", message);
View Full Code Here

    @Override
    public java.sql.Time getJavaTimeOnly(final String columnName) {
        try {
            final String string = set.getString(columnName);

            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");

            final DateTime utcDate = formatter.withZone(Defaults.getTimeZone()).parseDateTime(string);
            final java.sql.Time time = new java.sql.Time(utcDate.getMillis());

            return time;
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
View Full Code Here

    @Override
    public Time getTime(final String columnName) {
        try {
            final String string = set.getString(columnName);
            final DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
            final DateTimeZone defaultTimeZone = Defaults.getTimeZone();
            final DateTime utcDate = formatter.withZone(defaultTimeZone).parseDateTime(string);
            return new Time(utcDate);
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
        }
    }
View Full Code Here

    public String titleString(final Object value, final Localization localization) {
        if (value == null) {
            return null;
        }
        final LocalDate date = (LocalDate) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateUtil.titleString(f, date);
    }
View Full Code Here

        String format = getFormat();
        String startDate;
        if (Strings.isEmpty(format)) {
            startDate = value.toString();
        } else {
            DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(format);
            startDate = dateTimeFormatter.print(value);
        }
        put(StartDate, startDate);
        return this;
    }
View Full Code Here

        String format = getFormat();
        String endDate;
        if (Strings.isEmpty(format)) {
            endDate = value.toString();
        } else {
            DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(format);
            endDate = dateTimeFormatter.print(value);
        }
        put(EndDate, endDate);
        return this;
    }
View Full Code Here

TOP

Related Classes of org.joda.time.format.DateTimeFormatter

Copyright © 2018 www.massapicom. 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.