ottengo questo erroreFatal error: eccezione Uncaught 'Eccezione' con il messaggio 'DateTime :: __ construct(): Impossibile analizzare la stringa tempo
(!) Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (06-28-2014 07:43:58) at position 0 (0): Unexpected character' in /Users/matt/Desktop/Likes/forgot/activate.php on line 17
Quando si cerca di fare questo
//DB query
$stmt = $con->prepare("SELECT token_created_at from reset WHERE token = :urltoken");
$stmt->bindValue(':urltoken', $_GET['token']);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
while($row = $stmt->fetch()) {
$token_created_at = $row['token_created_at'];
}
//Remove after testing
echo $token_created_at;
$my_dt = new DateTime($token_created_at);
//Modify error
$expires_at = $my_dt->modify('+1 hour');
//Return current time to match
$current_time = date('m-d-Y H:i:s ', time());
Linea 17 è $my_dt = new DateTime($token_created_at);
e questo è il mio formato orario 06-28-2014 07:43:58
.
Ecco come generare token_created_at
, $time_gen = date('m-d-Y H:i:s ', time());
.
ho ancora ottenere l'errore nello _stesso_ .... –
@ user302975 prova ora. –
$ save = date_time ('06 -28-2014 07:43:58 '); sarebbe una variabile ... –