推荐当贝市场

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 18409|回复: 1

[教程] Android腾讯微薄客户端开发七:图片加圆角以及时间处理工具类

[复制链接]
发表于 2013-8-29 11:31 | 显示全部楼层 |阅读模式
   
Java代码   
   
  1. public class TimeUtil {   
               
            public static String converTime(long timestamp){   
                    long currentSeconds = System.currentTimeMillis()/1000;   
                    long timeGap = currentSeconds-timestamp;//与现在时间相差秒数   
                    String timeStr = null;   
                    if(timeGap>24*60*60){//1天以上   
                            timeStr = timeGap/(24*60*60)+"天前";   
                    }else if(timeGap>60*60){//1小时-24小时   
                            timeStr = timeGap/(60*60)+"小时前";   
                    }else if(timeGap>60){//1分钟-59分钟   
                            timeStr = timeGap/60+"分钟前";   
                    }else{//1秒钟-59秒钟   
                            timeStr = "刚刚";   
                    }   
                    return timeStr;   
            }   
               
            public static String getStandardTime(long timestamp){   
                    SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日 HH:mm");   
                    Date date = new Date(timestamp*1000);   
                    sdf.format(date);   
                    return sdf.format(date);   
            }   
    }
复制代码
      
发表于 2016-3-10 19:48 | 显示全部楼层
很给力,ZNDS有你更精彩!
回复 顶一个 踩

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /2 下一条

Archiver|小黑屋|新帖|标签|软件|Sitemap|ZNDS智能电视网 ( 苏ICP备2023012627号 )

GMT+8, 2026-11-8 08:47 , Processed in 0.024092 second(s), 9 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表