There is more than one way to do what you want, if you want to keep the value of input with snippets of code, you could do the following:
In your input, create a property name : <input name="data">
In the script where you process the data coming from the form you can take the data via $_POST['data']
or $_GET['data']
depending on the method chosen for sending the form.
At this point, I believe the user entered the date in d-m-Y format, right? OK... You will do something like this to convert to Y-m-d:
$data = new DateTime($_POST['data']);
$dataFormatada = $data->format('Y-m-d')
;
Remembering that from then on you can work normally by putting intervals or whatever you need and passing the responsibility of formatting the date to the script that handles the form after sending, you clean a little more your view and helps in readability and maintenance later.
Some links that may help: Manipulating dates with PHP, date
– rbz