返回时间差[返回秒]

        /// <summary>
        /// 返回时间差[返回秒]
        /// </summary>
        /// <param name="DateTimex">时间1(小)</param>
        /// <param name="DateTimed">时间2(大)</param>
        /// <returns>返回秒</returns>
        public static double TDiff(DateTime DateTimex, DateTime DateTimed)
        {
           return ((TimeSpan)(DateTimed - DateTimex)).TotalSeconds;
        }

程序调用:TDiff(DateTime.Now, DateTime.Now.AddHours(1))

运行结果:3600

posted @ 2011-08-09 19:24  .net|C#|js|jquery|css|div|html  阅读(1290)  评论(0编辑  收藏  举报