c#中获取当前时间戳的几种方法

        
第一种
/// 
        /// 获取当前时间戳
        /// 
        /// 
        public string GetTimeStamp()
        {
            TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalSeconds).ToString();
        }

第二种

/// 
        /// 获取时间戳
        /// 
        /// 
        public static string GetTimeStamp()
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
        }   

lua的获取时间戳

print(os.time())

 

你可能感兴趣的:(unity,android,ios)