From 1db0fdbbe20ace98f3c857b0e71274ae0b1953cd Mon Sep 17 00:00:00 2001 From: jx Date: Mon, 27 May 2024 11:11:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=EF=BC=8C=E5=A6=82=E6=9E=9C=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E4=B8=80=E5=B0=8F=E6=97=B6=EF=BC=8C=E4=BB=85=E6=98=BE=E7=A4=BA?= =?UTF-8?q?00:00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jx.Toolbox/Extensions/LongExtension.cs | 3 ++- Jx.Toolbox/Jx.Toolbox.csproj | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Jx.Toolbox/Extensions/LongExtension.cs b/Jx.Toolbox/Extensions/LongExtension.cs index 0f27aed..62c508c 100644 --- a/Jx.Toolbox/Extensions/LongExtension.cs +++ b/Jx.Toolbox/Extensions/LongExtension.cs @@ -60,8 +60,9 @@ public static string ToTimeString(this T value) where T : IConvertible // 使用TimeSpan从秒数创建时间间隔 TimeSpan time = TimeSpan.FromSeconds(seconds); + return time.ToString(time.TotalHours < 1 ? @"mm\:ss" : @"hh\:mm\:ss"); + // 返回格式化的时间字符串 - return time.ToString(@"hh\:mm\:ss"); } catch (OverflowException) { diff --git a/Jx.Toolbox/Jx.Toolbox.csproj b/Jx.Toolbox/Jx.Toolbox.csproj index bc49bf6..5bf4c10 100644 --- a/Jx.Toolbox/Jx.Toolbox.csproj +++ b/Jx.Toolbox/Jx.Toolbox.csproj @@ -9,7 +9,7 @@ https://github.com/j4587698/Jx.Toolbox MIT tool - 0.3.10 + 0.3.11