如果用c#把当前时间转化为Discuz中的posttime,也就是mysql中的时间戳Timestamp

 public static int DateToTimestamp(DateTime date)
        {
            DateTime origin = new DateTime(1970110000);
            TimeSpan diff = date - origin;
            int timestamp = (int)Math.Floor(diff.TotalSeconds);
            return timestamp;
        }

        public static DateTime TimestampToDate(double timestamp)
        {
            DateTime origin = new DateTime(1970110000);
            DateTime date = origin.AddSeconds(timestamp);
            return date;
        }
原文地址:https://www.cnblogs.com/goody9807/p/2434583.html