Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde estou tentando executar um script que é busca por datas e ele me aparece este erro
Fatal error: Call to undefined function date_create_from_format()
Segue o script:
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8" />
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
<title>CADASTRAR DEPARTAMENTO</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Login and Registration Form with HTML5 and CSS3" />
<meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
<meta name="author" content="Codrops" />
<script type="text/javascript">
function DoPrinting(){
if (!window.print){
alert("Use o Netscape ou Internet Explorer \n nas versões 4.0 ou superior!")
return
}
window.print()
}
</script>
<style rel="stylesheet" type="text/css" media="print">
#botao{display:none}
</style>
<?PHP
//include "sessao.php";
include "conecta.php";
?>
<?php if (empty($_POST['busca1']))
{
echo "Digite uma palavra-chave para sua busca";
echo "<script>window.location='buscaloc2.php';alert(''Coloque as Duas Datas-Lembrando qua primeira deve ser menor que a segunda');</script>";
}
else // define valores se o resultado não for vazio
{
$dataInicio = $_POST['busca'];
$date = date_create_from_format('d/m/Y', $dataInicio);
$dataInicio = date_format($date, 'Y-m-d');
$dataFim =$_POST['busca1'];
$date = date_create_from_format('d/m/Y', $dataFim);
$dataFim = date_format($date, 'Y-m-d');
// query de consulta
$sql = "SELECT *FROM roteiro WHERE data_rot AND data_rot BETWEEN '$dataInicio' AND '$dataFim' order by idrot ASC ";
// echo "Você tem um total de ".$total." Roteiros Nesta Data ".$dataInicio = $_POST['busca']."<br><br>";
// gera o loop com os resultados
while($linha = mysql_fetch_array($sql))
{
// echo "O ID que você procura é: ".$linha['pc_fil']."<br>";
// echo '<a href="pegasp.php?id='.$linha['id_fil'].'">'.$linha['pc_fil'].'</a><br>'."\n";
$idfil=$linha['idrot'];
$fil2=$linha['cli_rot'];
$fil3=$linha['raz_rot'];
$fil4=$linha['cnpj_rot'];
$fil5=$linha ['end_rot'];
$fil6=$linha['cont_rot'];
$fil7=$linha['tel_rot'];
$fil8=$linha['col_rot'];
$fil9=$linha['sol_rot'];
$fil10=$linha ['serv_rot'];
$fil11=$linha['data_rot'];
$fil12=$linha['obs_rot'];
$fil13=$linha['prot_rot'];
$partes_da_data = explode('-',$fil11);
$data_brasileiro = $partes_da_data[2].'/'.$partes_da_data[1].'/'.$partes_da_data[0];
$partes_da_data1 = explode('-',$fil11);
$data_brasileiro1 = $partes_da_data1[2].'/'.$partes_da_data1[1].'/'.$partes_da_data1[0];
$data1 = date("d/m/Y");
?>
<table width="200" border="0" >
<tr>
<td><table width="652" border="0" align="center">
<tr>
<td><label for="username13" class="uname" >CNPJ/CPF:</label></td>
<td><b><?php echo ($fil4)?></b></td>
</tr>
<tr>
<td><label for="username15" class="uname" >Cliente:</label></td>
<td><b><?php echo ($fil2)?></b></td>
</tr>
<tr>
<td><label for="username16" class="uname" >Razão Social:</label></td>
<td><b><?php echo ($fil3)?></b></td>
</tr>
<tr>
<td><label for="username14" class="uname" >Endereço:</label></td>
<td><b><?php echo ($fil5)?></b></td>
</tr>
<tr>
<td><label for="username17" class="uname" >Contato:</label></td>
<td><b><?php echo ($fil6)?></b></td>
</tr>
<tr>
<td width="160"><label for="username2" class="uname" >Telefone:</label></td>
<td width="482"><b><?php echo ($fil7)?></b></td>
</tr>
<tr>
<td><label for="username18" class="uname" >Colaborador:</label></td>
<td><b><?php echo ($fil8)?></b></td>
</tr>
<tr>
<td><label for="username6" class="uname" >Solicitante:</label></td>
<td><b><?php echo ($fil9)?></b></td>
</tr>
<tr>
<td><label for="username3" class="uname" > Data de Solicitação:</label></td>
<td><b><?php echo ($data_brasileiro)?></b></td>
</tr>
<tr>
<td colspan="2"><label for="username4" class="uname" >Existe Protocolo?:<b><?php echo ($fil13)?></b></label></td>
</tr>
</table>
<table width="652" border="0">
<tr>
<td><label for="username4" class="uname" >Observação:<b><?php echo ($fil12)?></b></label></td>
</tr>
</table>
<table width="652" border="0">
<tr>
<td><label for="username5" class="uname" ><center>Serviço a ser executado</center></label></td>
</tr>
</table>
<p><b><?php echo ($fil10)?></b></p>
<p> </p>
<p>------------------------------------------------------------------------------------------------------------</p>
<table width="655" border="0">
</table>
<p> </p>
<p> </p>
<table width="656" border="0">
</table></td>
</tr>
</table><br><br>
<?PHP
}}
?>
<input type="button" value="imprimir" onClick="DoPrinting()" id="botao" />
<div id="paginador" align="center">
</div>
OBRIGADO
Carregando comentários...