jimmychow

 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 + "分钟以前";
        }

分类:

技术点:

相关文章:

  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-12-27
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-10-12
  • 2022-12-23
相关资源
相似解决方案