zoukankan      html  css  js  c++  java
  • C# TimeSpan

    using System;
    using UnityEngine;
    
    TimeSpan timeSpan=TimeSpan.FromSeconds(10000);//10000秒
    Debug.LogFormat("{0} {1} {2}",timeSpan.Hours,timeSpan.Minutes,timeSpan.Seconds);//output: 2 46 40
    Debug.Log(timeSpan.ToString());//output: 02:46:40
    Debug.Log(timeSpan.ToString(@"hh:mm:ss"));//output: 02:46:40
    Debug.Log(timeSpan.ToString(@"mm:ss"));//output: 46:40
    
    //加减时间
    timeSpan=timeSpan.Add(TimeSpan.FromSeconds(1));
    Debug.Log(timeSpan.ToString(@"mm:ss"));//output: 46:41
    timeSpan=timeSpan.Add(TimeSpan.FromSeconds(-2));
    Debug.Log(timeSpan.ToString(@"mm:ss"));//output: 46:39
    

    更多字符串的格式

  • 相关阅读:
    4、2 核心组件
    promise
    Content-Type
    $routeProvider
    广告
    $apply() $digest()
    异常
    switch
    autoprefixer
    $resource
  • 原文地址:https://www.cnblogs.com/kingBook/p/13857507.html
Copyright © 2011-2022 走看看