unity获取时间格式
有很多⽅法
一生风景/// <summary>
借口英语/// 转为天-时:分:秒
/// </summary>1087年
public static string GetTimeDDHHMMSS(int totalSeconds)
{
香蕉皮的功效与作用int days = (totalSeconds / 3600) / 24;
int hours = (totalSeconds / 3600) - (days * 24);
int minutes = (totalSeconds - (hours * 3600) - (days * 86400)) / 60;
int conds = totalSeconds - (hours * 3600) - (minutes * 60) - (days * 86400);海纳百川书法作品
if(days > 0)
return string.Format("{0:D2}-{1:D2}:{2:D2}:{3:D2}", days, hours, minutes, conds);
el if(hours > 0)
孕妇可以吃芒果吗return string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, conds);
el
return string.Format("{0:D2}:{1:D2}", minutes, conds);
}
/// <summary>
/// 时:分:秒⽇/⽉/年的格式显⽰当前系统时间
/// </summary>
public static string GetTimeYTD()
{
广东金融学院分数线int hour = System.DateTime.Now.Hour;
int minute = System.DateTime.Now.Minute;
int cond = System.DateTime.Now.Second;
int year = System.DateTime.Now.Year;
int month = System.DateTime.Now.Month;娃娃鱼的叫声录音
int day = System.DateTime.Now.Day;
return string.Format("{0:D2}:{1:D2}:{2:D2} {3:D4}/{4:D2}/{5:D2}", hour, minute, cond, year, month, day); }