0
$con = mssql_connect($SqlServerIP, $SqlServerUser, $SqlServerPass) or die("Error en la conexión a MsSql");
mssql_select_db($SqlServerDB, $con);

$datetime_variable = new DateTime();
$horavotosdiff = @date("d/m/Y H:i:s", $datetime_variable);
$nuevafecha = strtotime ('-1 hour' , strtotime ($horavotosdiff ) ) ;

$sql = "(SELECT fecha FROM VoteReward WHERE ip = '$IP_Player' AND fecha > DATEADD(hh, -12, getDate()))";
$resultado = mssql_query($sql,$con);
if(mssql_num_rows($resultado)>0){
    $row=mssql_fetch_array($resultado);
    $fecha_ultima = $row['fecha'];
}

Me sale este error :

Fatal error: Class 'DateTime' not found in line 169

$datetime_variable = new DateTime(); linea 169

1 respuesta 1

2

La razón porque no encuentra la clase DateTime es porque está disponible desde la versión 5.2 de PHP.

Como tienes la versión 5.1.6 prueba ocupar lo siguiente:

Este formato:

$date = date('Y-m-d H:i:s');

O:

$date = date('Y/m/d H:i:s');

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.