2010-03-10 12 views

risposta

10

Questo dovrebbe essere sufficiente:

<?php 
$t = strtotime('tomorrow'); 

È possibile anche impostare un tempo:

<?php 
$t = strtotime('tomorrow 14:55'); 

Si prega di notare che, come altre caratteristiche di data in PHP, che utilizzeranno la default time zone a meno richiesto diversamente:

date_default_timezone_set('Asia/Tokyo'); 
$t = strtotime('tomorrow'); 
var_dump($t, date('r', $t)); 

date_default_timezone_set('Europe/Madrid'); 
$t = strtotime('tomorrow'); 
var_dump($t, date('r', $t)); 

date_default_timezone_set('Europe/Madrid'); 
// Generate midnight in New York, display equivalent Madrid time 
$t = strtotime('tomorrow America/New_York'); 
var_dump($t, date('r', $t)); 
int(1502204400) 
string(31) "Wed, 09 Aug 2017 00:00:00 +0900" 
int(1502229600) 
string(31) "Wed, 09 Aug 2017 00:00:00 +0200" 
int(1502251200) 
string(31) "Wed, 09 Aug 2017 06:00:00 +0200" 
+5

'strtotime (" mezzanotte domani ")' sembra funzionare :) –

+0

@ Ben James: bello sapere. Ho cercato su Google un sacco di volte per le specifiche esatte, ma non sembra che ci sia una pagina man incompleta e il codice C originale ... –

+0

Beh, non mi sento un pasticcio. Grazie per la risposta rapida. –