Skip to content

Commit

Permalink
修改时间格式化,如果不到一小时,仅显示00:00
Browse files Browse the repository at this point in the history
  • Loading branch information
j4587698 committed May 27, 2024
1 parent b30c7e1 commit 1db0fdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Jx.Toolbox/Extensions/LongExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public static string ToTimeString<T>(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)
{
Expand Down
2 changes: 1 addition & 1 deletion Jx.Toolbox/Jx.Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/j4587698/Jx.Toolbox</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>tool</PackageTags>
<PackageVersion>0.3.10</PackageVersion>
<PackageVersion>0.3.11</PackageVersion>
</PropertyGroup>

</Project>

0 comments on commit 1db0fdb

Please sign in to comment.