From 58567e5f8cc23611192adc6230aa904cea73c5a4 Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Wed, 19 Apr 2023 16:36:03 +0800 Subject: [PATCH] =?UTF-8?q?DateTime=E7=B1=BB=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=89=A9=E5=B1=95ToDate=E8=BF=94=E5=9B=9Eyyy?= =?UTF-8?q?y-MM-dd=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=EF=BC=8CToTime=E8=BF=94=E5=9B=9EHH:mm:ss=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E5=AD=97=E7=AC=A6=E4=B8=B2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Falcon.SugarApi/DateTimeExtend.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Falcon.SugarApi/DateTimeExtend.cs b/Falcon.SugarApi/DateTimeExtend.cs index e0d2aa9..e12ca02 100644 --- a/Falcon.SugarApi/DateTimeExtend.cs +++ b/Falcon.SugarApi/DateTimeExtend.cs @@ -97,6 +97,19 @@ namespace Falcon.SugarApi /// yyyyMMdd格式时间 public static string ToyyyyMMddHHmmss(this DateTime date) => date.ToString("yyyyMMddHHmmss"); + /// + /// 返回日期的年月日字符串,格式yyyy-MM-dd + /// + /// 时间 + /// 格式化日期字符串 + public static string ToDate(this DateTime date) => date.ToString("yyyy-MM-dd"); + /// + /// 返回时间的小时分秒字符串,格式HH:mm:ss + /// + /// 时间 + /// 格式化时间字符串 + public static string ToTime(this DateTime date) => date.ToString("HH:mm:ss"); + #endregion }