For us to display future dates on a web page, we have to follow these steps:
1. Open the page where you want to display a future date.
2. Go to Page Settings on the top of the website builder.
3. Choose Custom Code > Body End
4. Copy the code below into the box. This code will show tomorrow’s date, to show a date further in the future change the +1 in bold text.
<script>
const dd = new Date();
dd.setDate(dd.getDate() + 1);
document.getElementById("tomorrow").innerHTML = dd.toLocaleString('default', {day: 'numeric', month: 'long' });
</script>
Hit SAVE
5. Insert a custom code block from the left sidebar.
6. Copy the code below into the text/code area and HIT Save.
<div class="tomorrowbody">
<table class="offerdatetext">
<tbody>
<tr>
<td>Offer Expires
</td>
<td>
<p id="tomorrow">
</p>
</td>
</tr>
</tbody>
</table>
</div>
<style>
.offerdatetext {
margin-left: auto;
margin-right: auto;
}
.tomorrowbody, #tomorrow {
display: block !important;
margin-left: auto;
margin-right: auto;
background: #DC0000;
color: white!important;
font-family: 'Poppins', sans-serif;
font-weight: 700!important;
font-size: 20px;
text-align: center;
padding-top: 3px;
padding-bottom: 3px;
line-height: 1.2em;
}
</style>