December 4, 2013

Calculate 18 years age Flag including leap years

Ways to calculate 18 years age Flag including leap years:

1. Create Calculated Field of todays date in YYYYMMDD Format:
e.g: Formatted Today Date : ToChar(Today(),'YYYY') + ToChar(Today(),'MM') + ToChar(Today(), 'DD')
            Field Type: DTYPE_NUMBER

2. Create another Calculated Field Birth date in YYYYMMDD Format:
e.g: Formatted Birth Date : ToChar([Birth Date], 'YYYY') + ToChar([Birth Date], 'MM') + ToChar([Birth Date], 'DD')
            Field Type: DTYPE_NUMBER

3. Set the Calculated Age Under 18 Flag as mentioned below:
            Age Under 18 Flg : IIf(([Formatted Today Date] - [Formatted Birth Date]) < "180000", "Y", "N")
            Field Type: DTYPE_TEXT

You are done!

No comments:

Post a Comment