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.
|
|
|
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}分钟";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取现在时间戳,毫秒
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static long GetMilliTimeStamp()
|
|
|
|
{
|
|
|
|
return DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 获取现在时间戳,秒
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static long GetTimeStamp()
|
|
|
|
{
|
|
|
|
return DateTimeOffset.Now.ToUnixTimeSeconds();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|