19

Possible Duplicate:
How do I use PHP to get the current year?

2009 this year, 2010 next year.

1

5 Answers 5

45

Look at the functions date() and strtotime():

echo date('Y');
echo date('Y', strtotime('+1 year'));
Sign up to request clarification or add additional context in comments.

Comments

18

You can use the date function to extract a part of a date:

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

Run the snippet here.

Comments

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

Comments

1

Use getdate() function

Comments

1

...and strftime('%Y') does it too

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.