<input id="datepicker" name="datepicker" class="calendar" />
Here is my script:
<script>
$(function() {
$( "#datepicker" ).datepicker({ minDate: 0});
});
</script>
here php
if( $date < strtotime( date('m/d/Y', $time )) ) {
echo "<script>alert('You can't put past day..'); </script>"; }
I want to block the users enter past date wrongly or as know..but it does not work..i cant block..how can i block users enter past dates? i want only users can enter today n next days..so i want to filter with input in php.
strtotime()
doesn't take a format string, the function you want to use isDateTime::createFromFormat
. It returns aDateTime
object, not a timestamp, so you need to compare it with aDateTime
:DEMO