# Validating the Age with Date of Birth

**URL:** <https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925>\
**Category:** User Experience\
**Tags:** 8-7-2, user-experience, system-architect\
**Created:** [July 19, 2022, 3:35pm UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925 "2022-07-19T15:35:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MohamedAkeel](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/mohamedakeel/32/10001_2.png) [@MohamedAkeel](https://forums.pega.com/u/MohamedAkeel)\
**Post date:** [July 19, 2022, 3:35pm UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/1 "2022-07-19T15:35:39Z")

</div>

I am having this Error message when I tried to validate the **Age** from the date of birth with the current date.

**Problem invoking function: pega\_rules\_datetime.dateValue–(String), null**

 ![Error.png](https://pega1.discourse-cdn.com/pega/original/3X/5/8/58853dac82afb7a05ecbfccde2faa17e3c747e55.png)

**Here I have attached the expresseion**

 ![exp.png](https://pega1.discourse-cdn.com/pega/original/1X/1cb7a6e7076c69c54d4058cf047622efbbbf18ba.png)

---

<div class="post-metadata">

**Author:** ![P.Siva.Praveen](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/p.siva.praveen/32/22985_2.png) [@P.Siva.Praveen](https://forums.pega.com/u/P.Siva.Praveen)\
**Post date:** [July 19, 2022, 3:49pm UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/2 "2022-07-19T15:49:10Z")

</div>

@Mohamed_Akeel

Could you please check if you are passing the correct date format as the parameters in the tracer? Could you please share the complete logs to analyze the issue?

---

<div class="post-metadata">

**Author:** ![MohamedAkeel](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/mohamedakeel/32/10001_2.png) [@MohamedAkeel](https://forums.pega.com/u/MohamedAkeel)\
**Post date:** [July 19, 2022, 5:42pm UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/3 "2022-07-19T17:42:39Z")

</div>

Finally I found the solution my self. Here is the expression I am using.

```auto
@(Pega-RULES:ExpressionEvaluators).round(@(Pega-RULES:DateTime).DateTimeDifference(.DateOfBirth+"T000000.000 GMT",@(Pega-RULES:DateTime).CurrentDateTime(),"Y"))<17

```

 ![solution.png](https://pega1.discourse-cdn.com/pega/original/2X/7/7f43ba9362798f6fa4ecb3b211dae2d0c3837ed0.png)

---

<div class="post-metadata">

**Author:** ![MohamedAkeel](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/mohamedakeel/32/10001_2.png) [@MohamedAkeel](https://forums.pega.com/u/MohamedAkeel)\
**Post date:** [July 19, 2022, 5:49pm UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/4 "2022-07-19T17:49:44Z")

</div>

@PraveenSiva Thank you for your reply. I found the solution. I mentioned below.

---

<div class="post-metadata">

**Author:** ![RajashekarM16674385](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@RajashekarM16674385](https://forums.pega.com/u/RajashekarM16674385)\
**Post date:** [January 9, 2023, 5:02am UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/5 "2023-01-09T05:02:46Z")

</div>

@Mohamed_Akeel Thank you this helped me

---

<div class="post-metadata">

**Author:** ![MohamedAkeel](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/mohamedakeel/32/10001_2.png) [@MohamedAkeel](https://forums.pega.com/u/MohamedAkeel)\
**Post date:** [January 9, 2023, 5:45am UTC](https://forums.pega.com/t/validating-the-age-with-date-of-birth/2925/6 "2023-01-09T05:45:12Z")

</div>

@RajashekarM16674385 you are welcome.
