# Content validation: check against today's date possible?

**URL:** <https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568>\
**Category:** Synthetic Monitoring\
**Tags:** browser-monitors, synthetic-monitoring\
**Created:** [March 21, 2022, 3:04pm UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568 "2022-03-21T15:04:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![olga\_wall](https://avatars.discourse-cdn.com/v4/letter/o/b5e925/32.png) [@olga\_wall](https://community.dynatrace.com/u/olga_wall)\
**Post date:** [March 21, 2022, 3:04pm UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/1 "2022-03-21T15:04:19Z")

</div>

Hi all,

I know that it’s possible in browser monitors to validate against text, regex, and placeholders such as {email}.

I have a use case where I’d like to validate against today’s date (i.e. the date of the execution day). A regex wouldn’t be helpful in this case because there is a list of dates and I’d need a content validation of the latest.

Has anyone done something like this before? If yes, how? Or is this impossible to achieve with a synthetic monitor at all?

Thanks,

Olga

---

<div class="post-metadata">

**Author:** ![hannahmac](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/hannahmac/32/41823_2.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [March 22, 2022, 10:35am UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/2 "2022-03-22T10:35:43Z")

</div>

Hi Olga,

yes, date validation and manipulation are both possible in Dynatrace Synthetic. You can use&nbsp;api.date() to get the current date in epoch format. Then you can either convert it or compare it to a list of other epoch dates.

---

<div class="post-metadata">

**Author:** ![olga\_wall](https://avatars.discourse-cdn.com/v4/letter/o/b5e925/32.png) [@olga\_wall](https://community.dynatrace.com/u/olga_wall)\
**Post date:** [March 23, 2022, 9:59am UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/3 "2022-03-23T09:59:46Z")

</div>

Hi Hannah,

good to know, thanks!

Just to confirm: api.date() will also work with manually added JS events within browser clickpaths? Because I have only seen this reference only in the documentation section for HTTP monitors

---

<div class="post-metadata">

**Author:** ![hannahmac](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/hannahmac/32/41823_2.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [March 23, 2022, 10:17am UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/4 "2022-03-23T10:17:41Z")

</div>

Apologies, you’re right. We need to use&nbsp;&nbsp;Date.now() in the Browser Monitor JavaScript event instead. Good spot.

---

<div class="post-metadata">

**Author:** ![girish\_dindukur](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@girish\_dindukur](https://community.dynatrace.com/u/girish_dindukur)\
**Post date:** [April 12, 2022, 8:07am UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/5 "2022-04-12T08:07:17Z")

</div>

I have a similar scenario..can you please provide some example on how to resolve this

---

<div class="post-metadata">

**Author:** ![olga\_wall](https://avatars.discourse-cdn.com/v4/letter/o/b5e925/32.png) [@olga\_wall](https://community.dynatrace.com/u/olga_wall)\
**Post date:** [April 12, 2022, 2:33pm UTC](https://community.dynatrace.com/t/content-validation-check-against-todays-date-possible/34568/6 "2022-04-12T14:33:39Z")

</div>

Sorry, I haven’t implemented this use case yet and thus I don’t have any examples to share.&nbsp;  
But you can check the documentation on JavaScript events in browser monitors as a starting point: [Browser clickpath events in Classic — Dynatrace Docs](https://www.dynatrace.com/support/help/shortlink/id-brower-clickpath-events#javascript)
