rdlc报告中从出生日期算起的年龄 [英] calulating age from date of birth in rdlc reports
本文介绍了rdlc报告中从出生日期算起的年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我需要一个公式来计算我的rdlc报告中的年份和月份的客户年龄。我有出生日期字段。
解决方案
这将给出年份的差异
round(DateDiff( m,田地!DOB.Value,Now())/ 12)
这将在月份给出差异
DateDiff(m,fields!DOB.Value,Now())
= Floor(DateDiff( m,Fields!Birthdate.Value,Today() )/ 12).ToString()+ 年 +(DateDiff( m,Fields!Birthdate.Value,Today()) - (Floor(DateDiff( m,Fields!Birthdate.Value,Today())/ 12)* 12))。ToString()+ 月份
即使你的生日是明天
= IIF(DateTime.Today< DateAdd(DateInterval.Year,DateDiff(DateInterval.Year,Fields!fechaNacimiento.Value,DateTime.Today),Fields!fechaNacimiento.Value),DateDiff(DateInterval.Year) ,字段!fechaNacimiento.Value,DateTime.Today)-1,则DateDiff(DateInterval.Year,字段!fechaNacimiento.Value,DateTime.Today))
Hi i need a formula to calculate the clients age in years and months in my rdlc report. I have the date of birth field.
解决方案
this will give the difference in year
round(DateDiff("m",fields!DOB.Value,Now() )/12)
and this will give the diff in month
DateDiff("m",fields!DOB.Value,Now() )
=Floor(DateDiff("m",Fields!Birthdate.Value,Today())/12).ToString()+" Years " +(DateDiff("m",Fields!Birthdate.Value,Today())-(Floor(DateDiff("m",Fields!Birthdate.Value,Today())/12)*12)).ToString()+" Months"
This works even if your birthday is tomorrow
=IIF(DateTime.Today<DateAdd(DateInterval.Year,DateDiff(DateInterval.Year,Fields!fechaNacimiento.Value,DateTime.Today),Fields!fechaNacimiento.Value),DateDiff(DateInterval.Year,Fields!fechaNacimiento.Value,DateTime.Today)-1,DateDiff(DateInterval.Year,Fields!fechaNacimiento.Value,DateTime.Today))
这篇关于rdlc报告中从出生日期算起的年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文