asp.net 处理和计算微博发布时间(3)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:40 点击:次
}
#endregion
#region 返回该微博是什么时候发的
/// <summary>
/// 返回该微博是什么时候发的
/// </summary>
/// <param name="year">发微博时间</param>
/// <param name="month">当前时间</param>
public static string GetWhenSendTime(DateTime BlogTime, DateTime NowTime)
{
DateTime t1 = BlogTime;
DateTime t2 = NowTime;
string RES = "";
if ((t2 - t1).TotalMinutes > 1440)
{
RES = t1.ToString("yyyy年MM月dd日 HH:mm");
}
else
if ((t2 - t1).TotalMinutes > 60)
{
RES = Math.Floor(((t2 - t1).TotalMinutes / 60)).ToString() + "小时" + (Math.Floor((t2 - t1).TotalMinutes) % 60).ToString() + "分钟前";
}
else
{
if ((Math.Floor((t2 - t1).TotalMinutes) % 60) <= 0) RES = "刚刚更新";
else
RES = (Math.Floor((t2 - t1).TotalMinutes) % 60).ToString() + "分钟前";
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- asp.net DataTable和Dataset序列化成Json格式
- Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注
- 聊聊.net程序设计——浅谈使用VS2010建模拓展(下
- .NET设计模式:工厂方法模式(Factory Method)[1]
- 使用ASP.NET MVC3+EF+Jquery制作文字直播系统(四
- Web Service学习笔记(4)
- MVC3+Entity Framework 实现投票系统(二)
- .net架构的最后思考(箴言)
- .NET简谈互操作(四:基础知识之Dispose非托管内存
- JQuery+Asp.net MVC实现用户名重名查询



