增加日期时间格式化格式

This commit is contained in:
FalconFly 2023-12-27 10:14:25 +08:00
parent e7d60844ee
commit 488a717875

View File

@ -104,12 +104,24 @@ namespace Falcon.SugarApi
/// <returns>格式化日期字符串</returns> /// <returns>格式化日期字符串</returns>
public static string ToDate(this DateTime date) => date.ToString("yyyy-MM-dd"); public static string ToDate(this DateTime date) => date.ToString("yyyy-MM-dd");
/// <summary> /// <summary>
/// 返回日期的年月日字符串格式yyyy-MM-dd
/// </summary>
/// <param name="date">时间</param>
/// <returns>格式化日期字符串</returns>
public static string Toyyyy_MM_dd(this DateTime date) => date.ToString("yyyy-MM-dd");
/// <summary>
/// 返回时间的小时分秒字符串格式HH:mm:ss /// 返回时间的小时分秒字符串格式HH:mm:ss
/// </summary> /// </summary>
/// <param name="date">时间</param> /// <param name="date">时间</param>
/// <returns>格式化时间字符串</returns> /// <returns>格式化时间字符串</returns>
public static string ToTime(this DateTime date) => date.ToString("HH:mm:ss"); public static string ToTime(this DateTime date) => date.ToString("HH:mm:ss");
/// <summary> /// <summary>
/// 返回时间的小时分秒字符串格式HH:mm:ss
/// </summary>
/// <param name="date">时间</param>
/// <returns>格式化时间字符串</returns>
public static string ToHH_mm_ss(this DateTime date) => date.ToString("HH:mm:ss");
/// <summary>
/// 返回日期时间格式字符串。格式yyyy-MM-dd HH:mm:ss /// 返回日期时间格式字符串。格式yyyy-MM-dd HH:mm:ss
/// </summary> /// </summary>
/// <param name="date">时间</param> /// <param name="date">时间</param>