转移.net core 3.1,为.NET 5做准备

This commit is contained in:
ÂëÉñ
2020-10-22 14:59:36 +08:00
parent fd9bca23a7
commit a35d596237
1080 changed files with 175912 additions and 185681 deletions

View File

@@ -0,0 +1,42 @@
using System;
namespace Infrastructure.Helpers
{
public class DateTimeHelper
{
public static string FriendlyDate(DateTime? date)
{
if (!date.HasValue) return string.Empty;
string strDate = date.Value.ToString("yyyy-MM-dd");
string vDate = string.Empty;
if(DateTime.Now.ToString("yyyy-MM-dd")==strDate)
{
vDate = "今天";
}
else if (DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") == strDate)
{
vDate = "明天";
}
else if (DateTime.Now.AddDays(2).ToString("yyyy-MM-dd") == strDate)
{
vDate = "后天";
}
else if (DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") == strDate)
{
vDate = "昨天";
}
else if (DateTime.Now.AddDays(2).ToString("yyyy-MM-dd") == strDate)
{
vDate = "前天";
}
else
{
vDate = strDate;
}
return vDate;
}
}
}