org.joda.time.format.DateTimeFormatter#printTo ( )源码实例Demo

下面列出了org.joda.time.format.DateTimeFormatter#printTo ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: astor   文件: LimitChronology.java
public String getMessage() {
    StringBuffer buf = new StringBuffer(85);
    buf.append("The");
    String desc = super.getMessage();
    if (desc != null) {
        buf.append(' ');
        buf.append(desc);
    }
    buf.append(" instant is ");

    DateTimeFormatter p = ISODateTimeFormat.dateTime();
    p = p.withChronology(getBase());
    if (iIsLow) {
        buf.append("below the supported minimum of ");
        p.printTo(buf, getLowerLimit().getMillis());
    } else {
        buf.append("above the supported maximum of ");
        p.printTo(buf, getUpperLimit().getMillis());
    }
    
    buf.append(" (");
    buf.append(getBase());
    buf.append(')');

    return buf.toString();
}
 
源代码2 项目: astor   文件: LimitChronology.java
public String getMessage() {
    StringBuffer buf = new StringBuffer(85);
    buf.append("The");
    String desc = super.getMessage();
    if (desc != null) {
        buf.append(' ');
        buf.append(desc);
    }
    buf.append(" instant is ");

    DateTimeFormatter p = ISODateTimeFormat.dateTime();
    p = p.withChronology(getBase());
    if (iIsLow) {
        buf.append("below the supported minimum of ");
        p.printTo(buf, getLowerLimit().getMillis());
    } else {
        buf.append("above the supported maximum of ");
        p.printTo(buf, getUpperLimit().getMillis());
    }
    
    buf.append(" (");
    buf.append(getBase());
    buf.append(')');

    return buf.toString();
}
 
源代码3 项目: FROST-Server   文件: TimeInterval.java
@Override
public String asISO8601() {
    DateTimeFormatter printer = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC);
    printer = printer.withChronology(interval.getChronology());
    StringBuilder timeString = new StringBuilder(48);
    printer.printTo(timeString, interval.getStartMillis());
    timeString.append('/');
    printer.printTo(timeString, interval.getEndMillis());
    return timeString.toString();
}
 
源代码4 项目: astor   文件: AbstractInterval.java
/**
 * Output a string in ISO8601 interval format.
 * <p>
 * From version 2.1, the string includes the time zone offset.
 *
 * @return re-parsable string (in the default zone)
 */
public String toString() {
    DateTimeFormatter printer = ISODateTimeFormat.dateTime();
    printer = printer.withChronology(getChronology());
    StringBuffer buf = new StringBuffer(48);
    printer.printTo(buf, getStartMillis());
    buf.append('/');
    printer.printTo(buf, getEndMillis());
    return buf.toString();
}
 
源代码5 项目: astor   文件: AbstractInterval.java
/**
 * Output a string in ISO8601 interval format.
 * <p>
 * From version 2.1, the string includes the time zone offset.
 *
 * @return re-parsable string (in the default zone)
 */
public String toString() {
    DateTimeFormatter printer = ISODateTimeFormat.dateTime();
    printer = printer.withChronology(getChronology());
    StringBuffer buf = new StringBuffer(48);
    printer.printTo(buf, getStartMillis());
    buf.append('/');
    printer.printTo(buf, getEndMillis());
    return buf.toString();
}
 
源代码6 项目: jetstream-esper   文件: EPLUtilities.java
/**
 * @param key
 *          - 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();
}