# How to hide/show element based on the date.

**URL:** <https://forum.wixstudio.com/t/how-to-hide-show-element-based-on-the-date/40083>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [October 27, 2019, 5:45pm UTC](https://forum.wixstudio.com/t/how-to-hide-show-element-based-on-the-date/40083 "2019-10-27T17:45:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wbsites](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/wbsites/32/3078_2.png) [@wbsites](https://forum.wixstudio.com/u/wbsites)\
**Post date:** [October 27, 2019, 5:45pm UTC](https://forum.wixstudio.com/t/how-to-hide-show-element-based-on-the-date/40083/1 "2019-10-27T17:45:39Z")

</div>

Hi everyone,  
I have a database with a date feature and a page with an option to submit a form. I’d like to have a button to access the form but you can only do it if the day hasnt passed.

i.e Database has date field.  
if day has not passed show button on page.

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![samuele](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/samuele/32/10102_2.png) [@samuele](https://forum.wixstudio.com/u/samuele)\
**Post date:** [October 29, 2019, 12:18pm UTC](https://forum.wixstudio.com/t/how-to-hide-show-element-based-on-the-date/40083/2 "2019-10-29T12:18:29Z")

</div>

You can hide or disable a button if a condition is met with such a code:

if ( startDateTime \< Date.now()) {  
$w(“#bookButton”).disable();  
} else {  
$w(“#bookButton”).enable();  
}

For details on how to work with date and time in Corvid check out step 14 in the following article: [https://support.wix.com/en/article/corvid-tutorial-creating-a-bookings-timetable](https://slack-redir.net/link?url=https%3A%2F%2Fsupport.wix.com%2Fen%2Farticle%2Fcorvid-tutorial-creating-a-bookings-timetable)

---

<div class="post-metadata">

**Author:** ![info90204](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/info90204/32/14664_2.png) [@info90204](https://forum.wixstudio.com/u/info90204)\
**Post date:** [August 20, 2020, 5:21pm UTC](https://forum.wixstudio.com/t/how-to-hide-show-element-based-on-the-date/40083/3 "2020-08-20T17:21:12Z")

</div>

If you could please help making it DATE and Time dependent, so lets say the button to appear 60 minutes before startDateTime. Thanking you in advance.
