I have a question about how to make a function with the dates. It is a system to ask for vacations and as the end of the year arrives, there will be people who in 2019 will want to ask only for the days left in 2018. My intention in the system is the following:
In the application form they have a select field to choose the year they want to take vacations from. My intention is that until the end of the year, this field is read only, when we have entered 2019, that field is a selection to choose between 2019 and 2018, and that in March 2019 that field will be read again.
My function is as follows:
date_default_timezone_set('Europe/Madrid');
$fecha_actual = date("Y-m-d H:i:s");
$anno_actual = date("Y");
$anno_siguiente = date("Y") + 1;
$date = new Datetime("$anno_siguiente-01-01 00:00:00");
$findeanno = date_format($date, 'Y-m-d H:i:s');
$datemarzo = new Datetime("2019-03-01 00:00:00");
$marzo = date_format($marzo, 'Y-m-d H:i:s');
if($fecha_actual < $findeanno){
//campo readonly
}
Any help?