时隔三年,时间格式化类库 PrettyTime 4.0.1.Final 发布

栏目: 软件资讯 · 发布时间: 7年前

内容简介:PrettyTime 4.0.1.Final 已发布,距离上次发布的 4.0 已过去了整整三年。不过官网上依然没有该版本的改进记录说明。 下载地址:https://github.com/ocpsoft/prettytime/releases/tag/4.0.1.Final Maven: <depend...

PrettyTime 4.0.1.Final 已发布,距离上次发布的 4.0 已过去了整整三年。不过官网上依然没有该版本的改进记录说明。

下载地址:https://github.com/ocpsoft/prettytime/releases/tag/4.0.1.Final

Maven:

<dependency>
   <groupId>org.ocpsoft.prettytime</groupId>
   <artifactId>prettytime</artifactId>
   <version>4.0.1.Final</version>
</dependency>
<!-- To use snapshots, you must also use the Sonatype Snapshots respository -->
<repository>
   <id>sonatype-snapshots</id>
   <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>

Gradle:

compile 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'

PrettyTime 是一个开源的时间格式化类库。它能够将时间格式成易于用户阅读的格式,如"12分钟前"、"2天前"、"至今3个月"等。易于使用,完全可定制,可以创建属于自己 TimeUnit 和 TimeFormat 对象。能够与 JSF 框架集成使用。

示例代码:

import java.util.Date;
import com.ocpsoft.pretty.time.PrettyTime;
 
public class BasicJavaApp
{
	public static void main(String[] args) 
	{
		PrettyTime p = new PrettyTime();
		System.out.println(p.format(new Date()));
	}
}

【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python for Data Analysis

Python for Data Analysis

Wes McKinney / O'Reilly Media / 2012-11-1 / USD 39.99

Finding great data analysts is difficult. Despite the explosive growth of data in industries ranging from manufacturing and retail to high technology, finance, and healthcare, learning and accessing d......一起来看看 《Python for Data Analysis》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具