コード例 #1
0
ファイル: BaseModel.java プロジェクト: Roy-LinCC/pybbs
 /**
  * 格式化日期
  *
  * @param date
  * @return
  */
 public String formatDate(Date date) {
   String dateStr = "";
   if (date != null) {
     PrettyTime prettyTime = new PrettyTime(Locale.CHINA);
     dateStr = prettyTime.format(date);
   }
   return dateStr.replace(" ", "");
 }
コード例 #2
0
 /**
  * Return readable string of time different compare between 'then' and current time e.g 10 minutes
  * ago, 1 hour ago
  *
  * @param from
  * @param then
  * @return
  */
 public static String getHowLongAgoDescription(Date then) {
   Locale locale = Locale.getDefault();
   PrettyTime p = new PrettyTime(locale);
   return p.formatUnrounded(then);
 }
コード例 #3
0
ファイル: Project.java プロジェクト: ucliweiguang/RAP
 public String getLastUpdateStr() {
   PrettyTime p = new PrettyTime(new Locale("zh"));
   return p.format(this.updateTime) + "更新";
 }
コード例 #4
0
 public static final String prettyTime(long millisecond) {
   PrettyTime p = new PrettyTime();
   return p.format(new Date(millisecond));
 }
コード例 #5
0
 /**
  * 美化时间 如显示为 1小时前 2分钟前
  *
  * @return
  */
 public static final String prettyTime(Date date) {
   PrettyTime p = new PrettyTime();
   return p.format(date);
 }
コード例 #6
0
ファイル: SysKit.java プロジェクト: xiaomogui/apollo
 public static String beautyTime(Date createTime) {
   PrettyTime pt = new PrettyTime(Locale.CHINA);
   return pt.format(createTime);
 }