DateTime返回yyyy-MM-dd HH:mm:ss格式

This commit is contained in:
falcon 2023-05-05 13:53:36 +08:00
parent 1e07de9184
commit e442a099e6

View File

@ -109,6 +109,12 @@ namespace Falcon.SugarApi
/// <param name="date">时间</param>
/// <returns>格式化时间字符串</returns>
public static string ToTime(this DateTime date) => date.ToString("HH:mm:ss");
/// <summary>
/// 返回日期时间格式字符串。格式yyyy-MM-dd HH:mm:ss
/// </summary>
/// <param name="date">时间</param>
/// <returns>格式化时间字符串</returns>
public static string ToDateTime(this DateTime date) => date.ToString("yyyy-MM-dd HH:mm:ss");
#endregion
}