• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Block date (today) when it's passed 20:00 hours

Block date (today) when it's passed 20:00 hours 4 years 2 months ago #41015

  • jan007
  • jan007's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
In order to block dates in the date/time calender field I use this code in the min date :

//<code>
$currentdate = date('m/d/Y');
return date('m/d/Y', strtotime($currentdate. ' + 0 days'));
//</code>
(all days before today are blocked)

When the time has passed 20:00 hours I would like to block today as well:

//<code>
$currentdate = date('m/d/Y');
return date('m/d/Y', strtotime($currentdate. ' + 1 days'));
//</code>

In order to do this i duplicated the form. In 1 form dates are blocked untill today. In the other form dates are blocked including today.

I use this code to redirect from form 1 to form 2 at 20:00 hours.

<script type="text/javascript">
var hours = new Date().getHours();
if(hours >= 20){
window.location.href = "/te-laat";
}
</script>

Can someone help to combine these scripts so I do not need 2 forms?
Last Edit: 4 years 2 months ago by jan007.
The administrator has disabled public write access.
The following user(s) said Thank You: kontakt00

Block date when it's passed 20:00 hours 4 years 2 months ago #41016

  • jan007
  • jan007's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 1
Put this code in the min date section:

//<code>
$t = date("H");
if ($t >= "20") {
$currentdate = date('m/d/Y');
return date('m/d/Y', strtotime($currentdate. ' + 1 days'));
} else {
$currentdate = date('m/d/Y');
return date('m/d/Y', strtotime($currentdate. ' + 0 days'));
}
//</code>
Last Edit: 4 years 2 months ago by jan007. Reason: it works!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!