zoukankan      html  css  js  c++  java
  • 时间段计算

     public static string GetRelatedDateTime(object dateTime)
            {
                TimeSpan timeSpan = DateTime.Now - Convert.ToDateTime(dateTime);
                if (timeSpan.Days > 0)
                {
                    return timeSpan.Days + "天以前";
                }
                if (timeSpan.Hours > 0)
                {
                    return timeSpan.Hours + "小时以前";
                }
                return timeSpan.Minutes + "分钟以前";
            }

  • 相关阅读:
    学习进度14
    学习进度13
    学习进度12
    2020.12.01 表单元素
    2020.12.02 表单属性
    2020.12.04
    2020.12.06
    2020.12.07
    2020.12.08 URL
    2020.12.09
  • 原文地址:https://www.cnblogs.com/jimmychow/p/2366242.html
Copyright © 2011-2022 走看看