Examples of DateTimeFormatter


Examples of org.joda.time.format.DateTimeFormatter

    @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

Examples of org.joda.time.format.DateTimeFormatter

    @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

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

Examples of org.joda.time.format.DateTimeFormatter

        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

Examples of org.joda.time.format.DateTimeFormatter

        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

Examples of org.joda.time.format.DateTimeFormatter

    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

Examples of org.joda.time.format.DateTimeFormatter

            properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
        }

        // Need to get the ISO8601 date for properties
        DateTime dt = new DateTime( localResource.lastModified() );
        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
        String modifiedDate = fmt.print( dt );

        properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );

        properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

            }
        }
        final String timeZoneID = TimeZone.getDefault().getID();
        for (final DateTimeFormatter element : formattersNoUTC) {
            try {
                final DateTimeFormatter formatter = element.withZone(DateTimeZone.forID(timeZoneID));
                final DateTime dt = formatter.parseDateTime(str);
                final Calendar calendar = dt.toGregorianCalendar();
                calendar.setTimeZone(TimeZone.getDefault());
                return calendar;
            } catch (final IllegalArgumentException e) {
                // try with next formatter
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

*/
@Deprecated
public class JodaDateUtilities {
  public static String easyDateTimeFormat(String format) {
    DateTime currentDateAndTime = new DateTime();
    DateTimeFormatter formatter = DateTimeFormat.forPattern(format);

    return formatter.print(currentDateAndTime);
  }
View Full Code Here

Examples of org.joda.time.format.DateTimeFormatter

    //------------------------------------------------------------------------
   
    private void checkJodaToString() {
        int COUNT = COUNT_SLOW;
        DateTime dt = new DateTime(GJChronology.getInstance());
        DateTimeFormatter f = DateTimeFormat.forPattern("dd MMM yyyy");
        for (int i = 0; i < AVERAGE; i++) {
            start("Joda", "toString");
            for (int j = 0; j < COUNT; j++) {
                String str = dt.toString("dd MMM yyyy");
//                String str = dt.toString(f);
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.