Example usage for org.joda.time.format DateTimeFormatter printTo

List of usage examples for org.joda.time.format DateTimeFormatter printTo

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeFormatter printTo.

Prototype

public void printTo(Appendable appendable, ReadablePartial partial) throws IOException 

Source Link

Document

Prints a ReadablePartial.

Usage

From source file:com.ebay.jetstream.epl.EPLUtilities.java

License:GNU General Public License

/**
 * @param key//from  w w  w  .jav  a 2  s. c o  m
 *          - should be a field from the incoming event. This parameter is required only because Esper calls a method
 *          taking no arguments or constant values for all arguments only once in the entire run. To make Esper call
 *          the method for every event, the argument passed in to the method must be a field in the event. Esper 3.0
 *          has a config option to turn off this behaviour completely. The only option available in Esper 2.3 is to
 *          pass an argument.
 * @return
 */
public static String getCurrentDateInISO8601Format(Object key) {

    StringBuffer buf = new StringBuffer();
    DateTimeFormatter fmt = ISODateTimeFormat.basicDateTimeNoMillis();

    fmt.printTo(buf, System.currentTimeMillis());

    return buf.toString();
}

From source file:de.fraunhofer.iosb.ilt.sta.model.ext.TimeInterval.java

License:Open Source License

@Override
public String asISO8601() {
    DateTimeFormatter printer = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC);
    printer = printer.withChronology(interval.getChronology());
    StringBuffer buf = new StringBuffer(48);
    printer.printTo(buf, interval.getStartMillis());
    buf.append('/');
    printer.printTo(buf, interval.getEndMillis());
    return buf.toString();
}

From source file:org.cook_e.cook_e.BugReportActivity.java

License:Open Source License

/**
 * Starts the process of sending an E-mail message with the report
 * @param report the report to send/* ww  w .j  a  va  2  s  . c o m*/
 */
private void mailReport(BugReport report) {

    final StringBuilder message = new StringBuilder();
    final DateTimeFormatter formatter = ISODateTimeFormat.dateTimeNoMillis();
    message.append("Time: ");
    formatter.printTo(message, report.getDate());
    message.append('\n');
    message.append("User description: ");
    message.append(report.getDesc());
    message.append("\nMetadata: ");
    message.append(report.getMeta());

    ShareCompat.IntentBuilder.from(this).setType("message/rfc822").addEmailTo(REPORT_ADDRESS)
            .setSubject("Cook-E Problem Report").setText(message).setChooserTitle(R.string.mail_report)
            .startChooser();
    finish();
}