I wish to obtain the total sum of the days from the date of period 25-06-2018.
My problem is that the period date can not be modified and added by a third part of a form and the format is:
Tabla periodo
id periodo1 id
1 del 25 de Junio del 2018 varchar(50)
Tabla asistencias
id asistio2 id
1 26-06-2018 date
2 27-06-2018
3 28-06-2018
4 29-06-2018
my php queries are:
$periodo = sqlsrv_query($conn, "SELECT TOP 1 periodo1 FROM periodo ORDER BY idp DESC");
if($a=sqlsrv_fetch_array($periodo)) {
$ultimoPeriodo=$a['periodo1'];
}
$asist=sqlsrv_query($conn,
"SELECT asistio2 FROM asistencias WHERE asistio2 > $ultimoPeriodo");
if($d=sqlsrv_fetch_array($asist)){
$asist_suma+=date_format ($d['asistio2'], 'd-m-Y');
}
As I can not work subtracting text
to date
I would like to know what method I could use