You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
2 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace BBWY.Client.Helpers
|
||
|
{
|
||
|
public class OverTimeHelper
|
||
|
{
|
||
|
|
||
|
public static string GetTimeString(TimeSpan timespan)
|
||
|
{
|
||
|
if (timespan.TotalMilliseconds > 0)
|
||
|
{
|
||
|
if (timespan.Days > 0)
|
||
|
{
|
||
|
return $"{timespan.Days}天{timespan.Hours}小时{timespan.Minutes}分";
|
||
|
}
|
||
|
|
||
|
if (timespan.Hours > 0)
|
||
|
{
|
||
|
return $"{timespan.Hours}小时{timespan.Minutes}分";
|
||
|
}
|
||
|
return $"{timespan.Minutes}分钟";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (-timespan.Days > 0)
|
||
|
{
|
||
|
return $"{-timespan.Days}天{-timespan.Hours}小时{-timespan.Minutes}分";
|
||
|
}
|
||
|
|
||
|
if (-timespan.Hours > 0)
|
||
|
{
|
||
|
return $"{-timespan.Hours}小时{-timespan.Minutes}分";
|
||
|
}
|
||
|
return $"{-timespan.Minutes}分钟";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|