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 LocalDateTime dateTime = (LocalDateTime) value;
        DateTimeFormatter f = titleStringFormatter;
        if (localization != null) {
            f = titleStringFormatter.withLocale(localization.getLocale());
        }
        return JodaLocalDateTimeUtil.titleString(f, dateTime);
    }
View Full Code Here


            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

            }
        }
        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

*/
@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

    //------------------------------------------------------------------------
   
    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

    }

    private void checkJISOToString() {
        int COUNT = COUNT_SLOW;
        DateTime dt = new DateTime();
        DateTimeFormatter f = DateTimeFormat.forPattern("dd MMM yyyy");
        for (int i = 0; i < AVERAGE; i++) {
            start("JISO", "toString");
            for (int j = 0; j < COUNT; j++) {
                String str = dt.toString("dd MMM yyyy");
//                String str = dt.toString(f);
View Full Code Here

        @Override
        public DateTime getTimeStamp() {
            DateTime dt = null;
            String text = getLabelElement().getText();
            String timeStamp = text.substring(text.indexOf('[') + 1, text.indexOf(']'));
            DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:m:s.S");
            try {
                dt = formatter.parseDateTime(timeStamp);
            } catch (IllegalArgumentException e) {
                throw new RuntimeException("Something went wrong with parsing of log entry timestamp!", e);
            }
            return dt;
        }
View Full Code Here

            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

  public void testParseDateSampleDate() {
    String printed = "Tue, 22 Oct 2013 19:28:45 GMT";
    Date date = URLFetchUtils.parseDate(printed);
    assertNotNull(date);

    DateTimeFormatter gcsFormat =
        DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss z").withZoneUTC();
    assertEquals(printed.substring(0, printed.length() - 4),
        gcsFormat.print(date.getTime()).substring(0, printed.length() - 4));
  }
View Full Code Here

    public void exportHtmlTableToExcel() throws IOException{       
       
        //Set the filename
        DateTime dt = new DateTime();
        DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd_HHmmss");
        String filename = dt.toString(fmt) + ".xls";
       
       
        //Setup the output
        String contentType = "application/vnd.ms-excel";
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.