c#时间戳

/// <summary>
        /// 当前时间戳
        /// </summary>
        /// <returns></returns>
        public static long timestamp()
        {
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
            return (long)((DateTime.Now - startTime).TotalSeconds);
        }


你可能感兴趣的:(c#时间戳)