2009-08-31 13 views

risposta

33

Controlli la data di funzioni() e strtotime():

echo date('Y'); 
echo date('Y', strtotime('+1 year')); 
13

È possibile utilizzare la funzione di data per estrarre una parte di una data:

$year = date("Y"); // get the year part of the current date 
$nextYear = $year + 1; 

Eseguire il frammento di here.

0

... e strftime('%Y') lo fa troppo

6
<?php 
$date="2010-04-30"; 
$y = date('Y',strtotime($date)); 
echo $y; 
?> 
Problemi correlati