博客评论时间显示算法
来源:互联网 发布:无法触碰 知乎 编辑:程序博客网 时间:2024/04/29 16:41
-(NSString *)compareCurrentTime:(NSDate*) compareDate{NSTimeInterval timeInterval = [compareDate timeIntervalSinceNow];timeInterval = -timeInterval;timeInterval +=8*3600-240;int temp = 0;NSString *result;if (timeInterval < 60) {result = [NSString stringWithFormat:@"刚刚"];}else if((temp = timeInterval/60) <60){result = [NSString stringWithFormat:@"%d分钟前",temp];}else if((temp = temp/60) <24){result = [NSString stringWithFormat:@"%d小时前",temp];}else if((temp = temp/24) <30){result = [NSString stringWithFormat:@"%d天前",temp];}else if((temp = temp/30) <12){result = [NSString stringWithFormat:@"%d月前",temp];}else{temp = temp/12;result = [NSString stringWithFormat:@"%d年前",temp];}return result;}
0 0
- 博客评论时间显示算法
- 创建博客-评论部分(提交和显示)
- Angular 实现类似博客评论的递归显示
- 没有评论的博客
- 评论博客声明
- 在时间电影评论
- web学习之博客小项目(实现点击数和评论数的显示)
- 动态显示论坛评论、
- 完美解决layDate强制动态显示当前时间(不求评论,但求疯狂转载!)
- 获取时间差:发表评论或者其他内容时显示时间为几秒前,几小时前
- 博客项目对文章评论
- CSDN博客评论插入表情
- CSDN博客评论插入超链接
- wodpress博客的评论外链转内链
- 纯js模仿博客评论
- github博客如何增加评论?
- csdn博客设置评论权限
- Reddit评论排名算法
- Composer安装说明
- HDU5692 Snacks(dfs序 + 线段树)
- 使用eclipse开发servlet
- 浅谈Servlet的页面跳转
- [Android] CircleView 仿小米空气净化器首页旋转UI
- 博客评论时间显示算法
- [SCU 4509] Snowdrop修长廊 (斜率DP)
- web服务器 java实现
- OnPress长按事件
- LeetCode 133. Clone Graph(克隆图)
- Apache Solr查询语法
- android开发中build文件删除不了的问题
- python的多线程编程之锁
- tomcat以debug模式启动方法