首页 > 代码库 > 关于时间的转换

关于时间的转换

//把秒转换成分钟 
       /// <summary>
        /// 把秒转换成分钟
        /// </summary>
        /// <returns></returns>
        public static int SecondToMinute(int Second)
        {
            //   / 换成 * 号就是 把分钟换成秒
            decimal mm = (decimal)((decimal)Second / (decimal)60);   
            Console.WriteLine(mm);
            return Convert.ToInt32(Math.Ceiling(mm));
        }

 

        /// <summary>
        /// 返回某年某月最后一天
        /// </summary>
        /// <param name="year">年份</param>
        /// <param name="month">月份</param>
        /// <returns></returns>
        public static int GetMonthLastDate(int year, int month)
        {
            DateTime lastDay = new DateTime(year, month, new System.Globalization.GregorianCalendar().GetDaysInMonth(year, month));
            int Day = lastDay.Day;
            return Day;
        }