C#处理和计算微博发布时间
来源:互联网 发布:属性数据是什么意思 编辑:程序博客网 时间:2024/05/09 11:22
///<summary>
///八秒换成分钟的方法
///</summary>
///<param name="Second"></param>
///<returns></returns>
public static int SecondToMinute(intSecond) {
decimal mm=(decimal)(decimal)Second/(decimal)60;
return Convert.ToInt32(Math.Ceiling(double.Parse(mm.ToString())));
}
///<summary>
///返回某年某月最后一天
///</summary>
///<param name="year">年¨º份¤Y</param>
///<param name="month">月?份¤Y</param>
///<returns></returns>
public static int GetMonthLastDate(intyear,int month) {
DateTime lastDay =newDateTime(year,month,newSystem.Globalization.GregorianCalendar().GetDaysInMonth(year,month));
int Day = lastDay.Day;
return Day;
}
///<summary>
///返回时间差
///</summary>
///<param name="DateTime1"></param>
///<param name="DateTime2"></param>
///<returns></returns>
public static string DateDiff(DateTimeDateTime1,DateTime DateTime2) {
string datediff = null;
try {
TimeSpan ts = DateTime2 - DateTime1;
if (ts.Days >= 1)
{
datediff = DateTime1.Month.ToString() + "月" + DateTime1.Day.ToString() +"日";
}
else {
if (ts.Hours > 1)
{
datediff =ts.Hours.ToString() + "小时前";
}
else {
datediff =ts.Minutes.ToString() + "分钟前";
}
}
}catch(Exception){}
return datediff;
}
///<summary>
///返回该微博是什么时候发的
///</summary>
///<param name="BlogTime">发微博时间</param>
///<param name="NowTime">当前时间</param>
///<returns></returns>
public static stringGetWhenTime(DateTime BlogTime,DateTime NowTime) {
DateTime t1 = BlogTime;
DateTime t2 = NowTime;
string RRS = "";
if ((t2 - t1).TotalMinutes > 1440)
{
RRS = t1.ToString("yyyy年MM月dd日 HH:mm");
}
else {
if ((t2 - t1).TotalMinutes > 60)
{
RRS = Math.Floor(((t2 -t1).TotalMinutes / 60)).ToString() +"小时" + (Math.Floor((t2 - t1).TotalMinutes)% 60).ToString() +"分钟前";
}
else {
if ((Math.Floor((t2- t1).TotalMinutes) % 60) <= 0) RRS ="刚刚更新";
else {
RRS = (Math.Floor((t2 - t1).TotalMinutes) % 60).ToString()+"分钟前";
}
}
}
return RRS;
}
- C#处理和计算微博发布时间
- asp.net 处理和计算微博发布时间
- C#时间处理(DateTime和TimeSpan计算时间差)
- 时间处理(仿朋友圈、微博发布时间)
- C#时间处理(DateTime和TimeSpan)
- C#时间处理(DateTime和TimeSpan)
- C#时间处理(DateTime和TimeSpan)
- C#时间处理(DateTime和TimeSpan)
- C#时间处理(DateTime和TimeSpan)
- C# DateTime时间和字符串的处理
- C#时间处理(DateTime和TimeSpan)
- 朋友圈动态发布时间计算
- 朋友圈动态发布时间计算
- 朋友圈动态发布时间计算
- c# 计算时间间隔
- c# 计算时间间隔
- c#时间的计算
- C#时间间隔计算
- 2012,梦想启航(新的开始)
- 数组练习以及运用cout测试程序
- 搜狗2013校园招聘笔试题 高清扫描(网络首发,共20页)
- android流媒体框架介绍
- JPA的查询语言:JPQL的简单查询
- C#处理和计算微博发布时间
- 今年全球智能手机出货量预计将超过7亿部
- 穿越时间的魅力 周迅电影造型 (多图)
- directdraw direct3d 保存位图
- 转fedora9 热烈庆祝我的Fedora9能够完美使用
- 基于VxBus设备驱动程序架构的设备驱动开发
- Java持久化bean原理(一)
- 图灵奖得主Lampson:计算的未来 从建模和联系到现实交互
- 去物理文件名字