# Is there a simple way to validate a variable is a date?

**URL:** <https://forums.eggplantsoftware.com/t/is-there-a-simple-way-to-validate-a-variable-is-a-date/14572>\
**Category:** Uncategorized\
**Created:** [August 28, 2025, 7:01pm UTC](https://forums.eggplantsoftware.com/t/is-there-a-simple-way-to-validate-a-variable-is-a-date/14572 "2025-08-28T19:01:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GTPWilks](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/gtpwilks/32/170_2.png) [@GTPWilks](https://forums.eggplantsoftware.com/u/GTPWilks)\
**Post date:** [August 28, 2025, 7:01pm UTC](https://forums.eggplantsoftware.com/t/is-there-a-simple-way-to-validate-a-variable-is-a-date/14572/1 "2025-08-28T19:01:19Z")

</div>

In short client gives me a files and sometimes the DOB variable has a real date in it and other times it has text it in such as random or AdultMale.  
What I would like to do is something simple like

If DOB is a date  
// use this date  
Else  
// call handler to generate a date  
End if

This if statement doesnt work since “a date” isnt valid but is there a simple way to do this without using some logic around contains only these characters or something. Trying to make it generic as possible

---

<div class="post-metadata">

**Author:** ![Marcell\_Balla](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/marcell_balla/32/589_2.png) [@Marcell\_Balla](https://forums.eggplantsoftware.com/u/Marcell_Balla)\
**Post date:** [August 29, 2025, 9:52am UTC](https://forums.eggplantsoftware.com/t/is-there-a-simple-way-to-validate-a-variable-is-a-date/14572/2 "2025-08-29T09:52:01Z")

</div>

This should work in my opinion.

```auto
> set myDate to today
> put myDate
2025-08-29
> put myDate is a date
True

```

Maybe the format of the variable value is not recognised. You can define those with the “the timeInputFormat” global property. See the EPF documentation for more details.

---

<div class="post-metadata">

**Author:** ![GTPWilks](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/gtpwilks/32/170_2.png) [@GTPWilks](https://forums.eggplantsoftware.com/u/GTPWilks)\
**Post date:** [August 29, 2025, 1:07pm UTC](https://forums.eggplantsoftware.com/t/is-there-a-simple-way-to-validate-a-variable-is-a-date/14572/3 "2025-08-29T13:07:49Z")

</div>

Thanks.

I must have had a typo or something because I had swore I tried

If DOB is a date  
do this

and I got an error but I went back and redid it and all was good so thanks for making me go back and retry 😄
