Jump to content

[28-Feb-2011 14:48:37] PHP Warning: checkdate() expects parameter 1 to be long,


pedromsouza

Recommended Posts

When I use a method within a class, I get this error:

 

[28-Feb-2011 14:48:37] PHP Warning:  checkdate() expects parameter 1 to be long, string given in /Applications/MAMP/htdocs/classe_PreparaData.inc on line 17

 

Class Itself

 

class PreparaData {

 

public $saida;

 

function validar_input ($entrada) {

 

if(!(strlen($entrada)==10) and (strstr($entrada,'/')))

{echo "A data deve respeitar a formatação dd/mm/aaaa!<br>";}

}

 

function montar_timestamp ($entrada) {

$a_partes=explode("/",$entrada);

echo $a_partes[1].$a_partes[0].$a_partes[2].'<br>';

if(checkdate('$a_partes[1]','$a_partes[0]','$a_partes[2]'))

{function exibir_data ($a_partes){

if(!(empty($a_partes)))

{echo "$a_partes[1].$a_partes[0].$a_partes[2]";}

;};}

else

{echo "Data inválida!<br>"; var_dump($a_partes);}

}

 

function gravar_output ($saida) {

$query=mysql_query("insert into tabela value ('$saida')");

}

}

?>

 

Help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.