Refine search
/** * Output the date using the specified format pattern. * * @param pattern the pattern specification, null means use <code>toString</code> * @see org.joda.time.format.DateTimeFormat */ public String toString(String pattern) { if (pattern == null) { return toString(); } return DateTimeFormat.forPattern(pattern).print(this); }
/** * Returns the current time in yyMMdd-hhmmss format. */ public static String yyMMdd_hhmmss() { return DateTimeFormat.forPattern("yyMMdd-hhmmss").print(new DateTime()); } }
public String formatDate(final long timeMS) { if (timeMS == -1) { return "-"; } return DateTimeFormat.forPattern(DATE_TIME_STRING).print(timeMS); }
/** * Can be used to format a date into http header compatible * strings. * * It can be used to generate something like: * Date: Wed, 05 Sep 2012 09:16:19 GMT * Expires: Thu, 01 Jan 1970 00:00:00 GMT * * @param date The date to format * @return a http header compatible string like "Thu, 01 Jan 1970 00:00:00 GMT" */ public static String formatForHttpHeader(Date date) { return RFC1123_DATE_FORMAT.print(new DateTime(date)); }
static String yyMMdd_hhmmss() { return DateTimeFormat.forPattern("yyMMdd-hhmmss").print(new DateTime()); }
public String formatDate(final DateTime date, final String format) { final DateTimeFormatter f = DateTimeFormat.forPattern(format); return f.print(date); } }
/** * Can be used to format a unix timestamp into * http header compatible strings. * * It can be used to generate something like: * Date: Wed, 05 Sep 2012 09:16:19 GMT * Expires: Thu, 01 Jan 1970 00:00:00 GMT * * @param date The long (unixtime) to format * @return a http header compatible string like "Thu, 01 Jan 1970 00:00:00 GMT" */ public static String formatForHttpHeader(Long unixTime) { return RFC1123_DATE_FORMAT.print(new DateTime(unixTime)); }
final DateTime dt = new DateTime(); final DateTimeFormatter dateFormat = DateTimeFormat.forPattern("MMM d, yyyy 'at' HH:mm:ss z"); final DateTimeFormatter dateFormatXML = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); final String scanDate = dateFormat.print(dt); final String scanDateXML = dateFormatXML.print(dt);
private void write(SerializeWriter out, ReadablePartial object, String format) { DateTimeFormatter formatter; if (format == formatter_iso8601_pattern) { formatter = formatter_iso8601; } else { formatter = DateTimeFormat.forPattern(format); } String text = formatter.print(object); out.writeString(text); } }
public static String x1( Vec v, long row, double d ) { if( (row >= 0 && v.isNA(row)) || Double.isNaN(d) ) return "-"; // Display of missing elements if( v.isEnum() ) return row >= 0 ? v.domain(v.at8(row)) : Long.toString((long)d); if( v.isTime() ) { String tpat = v.timeParse(); DateTime dt = new DateTime(row >= 0 ? v.at8(row) : (long)d); DateTimeFormatter fmt = DateTimeFormat.forPattern(tpat); String str = fmt.print(dt); return str; } if( v.isInt() ) return Long.toString(row >= 0 ? v.at8(row) : (long)d); Chunk c = v.chunkForChunkIdx(0); Class Cc = c.getClass(); if( Cc == C1SChunk.class ) return x2(d,((C1SChunk)c)._scale); if( Cc == C2SChunk.class ) return x2(d,((C2SChunk)c)._scale); return Double.toString(d); }
/** * Output the date using the specified format pattern. * * @param pattern the pattern specification, null means use <code>toString</code> * @see org.joda.time.format.DateTimeFormat */ public String toString(String pattern) { if (pattern == null) { return toString(); } return DateTimeFormat.forPattern(pattern).print(this); }
public String formatDate(final long timestamp, final String format) { final DateTimeFormatter f = DateTimeFormat.forPattern(format); return f.print(timestamp); }
public String formatDateTime(final DateTime dt) { return DateTimeFormat.forPattern(DATE_TIME_STRING).print(dt); }
/** * Output the date using the specified format pattern. * * @param pattern the pattern specification, null means use <code>toString</code> * @see org.joda.time.format.DateTimeFormat */ public String toString(String pattern) { if (pattern == null) { return toString(); } return DateTimeFormat.forPattern(pattern).print(this); }