本文整理了Java中org.joda.time.format.DateTimeFormatter.print()
方法的一些代码示例,展示了DateTimeFormatter.print()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTimeFormatter.print()
方法的具体详情如下:
包路径:org.joda.time.format.DateTimeFormatter
类名称:DateTimeFormatter
方法名:print
[英]Prints a millisecond instant to a String.
This method will use the override zone and the override chronololgy if they are set. Otherwise it will use the ISO chronology and default zone.
[中]将毫秒瞬间打印到字符串。
如果设置了覆盖区域和覆盖计时,则此方法将使用覆盖区域和覆盖计时。否则,它将使用ISO年表和默认区域。
代码示例来源:origin: joda-time/joda-time
/**
* 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);
}
代码示例来源:origin: aws/aws-sdk-java
/**
* Returns the current time in yyMMdd-hhmmss format.
*/
public static String yyMMdd_hhmmss() {
return DateTimeFormat.forPattern("yyMMdd-hhmmss").print(new DateTime());
}
}
代码示例来源:origin: aws/aws-sdk-java
@Override
public void serialize(Date date,
JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws
IOException {
jsonGenerator.writeString(FORMATTER.print(new DateTime(date, DateTimeZone.UTC)));
}
});
代码示例来源:origin: azkaban/azkaban
public String formatDate(final long timeMS) {
if (timeMS == -1) {
return "-";
}
return DateTimeFormat.forPattern(DATE_TIME_STRING).print(timeMS);
}
代码示例来源:origin: ninjaframework/ninja
/**
* 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));
}
代码示例来源:origin: aws/aws-sdk-java
static String yyMMdd_hhmmss() {
return DateTimeFormat.forPattern("yyMMdd-hhmmss").print(new DateTime());
}
代码示例来源:origin: azkaban/azkaban
public String formatDate(final DateTime date, final String format) {
final DateTimeFormatter f = DateTimeFormat.forPattern(format);
return f.print(date);
}
}
代码示例来源:origin: ninjaframework/ninja
/**
* 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));
}
代码示例来源:origin: jeremylong/DependencyCheck
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);
代码示例来源:origin: alibaba/fastjson
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);
}
}
代码示例来源:origin: Codecademy/EventHub
public synchronized String getDate() {
return FORMATTER.print(new DateTime());
}
}
代码示例来源:origin: h2oai/h2o-2
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);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* 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);
}
代码示例来源:origin: stackoverflow.com
DateTime dt = new DateTime();
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String dtStr = fmt.print(dt);
代码示例来源:origin: azkaban/azkaban
public String formatDate(final long timestamp, final String format) {
final DateTimeFormatter f = DateTimeFormat.forPattern(format);
return f.print(timestamp);
}
代码示例来源:origin: stackoverflow.com
DateTime jodaTime = new DateTime();
DateTimeFormatter formatter = DateTimeFormat.forPattern("YYYY-MM-dd HH:mm:ss.SSS");
System.out.println("jodaTime = " + formatter.print(jodaTime));
代码示例来源:origin: azkaban/azkaban
public String formatDateTime(final DateTime dt) {
return DateTimeFormat.forPattern(DATE_TIME_STRING).print(dt);
}
代码示例来源:origin: gocd/gocd
public String getHumanReadableString(Date date) {
return date == null ? ConvertedTime.NOT_AVAILABLE.toString() : dateFormatter.print(new DateTime(date));
}
代码示例来源:origin: joda-time/joda-time
/**
* 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);
}
代码示例来源:origin: gocd/gocd
public String getHumanReadableStringWithTimeZone(Date date) {
return date == null ? ConvertedTime.NOT_AVAILABLE.toString() : dateFormatterWithTimeZone.print(new DateTime(date));
}
内容来源于网络,如有侵权,请联系作者删除!