<form action="" method=""> <fielset> <legend>Local Pickup Date and Time</legend> <label>Choose Date: <input type="date" name="date" id="date"></label> <label>Choose Time: <input type="time" name="time" id="time"></label> <input type="submit" value="Submit" > </fielset> </form> 

How can I limit the range of the selected date and time? Or prohibit the choice of Sunday days, for example, how this can be done using JS on the client and PHP on the server.

    1 answer 1

    JS is not needed - we read , understand, we understand that there is an attribute min and max .
    Example: <input type="date" min="2015-01-01" max="2016-01-01" /> .
    Value: 2015-03-01 .

    In PHP, you can use DateTime : https://php.net/manual/ru/datetime.diff.php

    Restrict days like "Sunday" - there must be considered.
    For example:

     $dayOfWeek = ["вс", "пн", "вт", "ср", "чт", "пт", "сб"]; $str = $dayOfWeek [date("w", mktime (0, 0, 0, $cur_month, $cur_day, $cur_year))]; 

    Or this: Determine the day of the week by date

    • it's a new format :) - Gena Moroz