C#处理和计算微博发布时间

///<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("yyyyMMdd 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;

        }

 

 

**项目概述:** 本资源提供了一套采用Vue.js与JavaScript技术栈构建的古籍文献文字检测与识别系统的完整源代码及相关项目文档。当前系统版本为`v4.0+`,基于`vue-cli`脚手架工具开发。 **环境配置与运行指引:** 1. **获取项目文件**后,进入项目主目录。 2. 执行依赖安装命令: ```bash npm install ``` 若网络环境导致安装缓慢,可通过指定镜像源加速: ```bash npm install --registry=https://registry.npm.taobao.org ``` 3. 启动本地开发服务器: ```bash npm run dev ``` 启动后,可在浏览器中查看运行效果。 **构建与部署:** - 生成测试环境产物: ```bash npm run build:stage ``` - 生成生产环境优化版本: ```bash npm run build:prod ``` **辅助操作命令:** - 预览构建后效果: ```bash npm run preview ``` - 结合资源分析报告预览: ```bash npm run preview -- --report ``` - 代码质量检查与自动修复: ```bash npm run lint npm run lint -- --fix ``` **适用说明:** 本系统代码经过完整功能验证,运行稳定可靠。适用于计算机科学、人工智能、电子信息工程等相关专业的高校师生、研究人员及开发人员,可用于学术研究、课程实践、毕业设计或项目原型开发。使用者可在现有基础上进行功能扩展或定制修改,以满足特定应用场景需求。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值