成都创新互联网站制作重庆分公司

C#根据出生日期计算年龄

public int CalculateAge(DateTime birthDate, DateTime now)
        {
            int age = now.Year - birthDate.Year;
            if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day))
            {
                age--;
            }
            return age;
        }

成都创新互联公司主营南木林网站建设的网络公司,主营网站建设方案,成都App制作,南木林h5小程序开发搭建,南木林网站营销推广欢迎南木林等地区企业咨询


本文标题:C#根据出生日期计算年龄
文章位置:http://cxhlcq.com/article/jdgdgh.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部