Wouter
Wouter

Reputation: 495

PHP date actual year

I have this:

$startdate = date("Y-m-d", strtotime('2015-' . $startmonth . '-01'));

But instead of filling in the year, how do I get the current year?

Upvotes: 4

Views: 1751

Answers (2)

user5686312
user5686312

Reputation:

You can use date, since the year will remain a year. for instance,

<?php echo date("Y"); ?>

Personal experience in researching in Google.

Upvotes: 2

rccoros
rccoros

Reputation: 590

You can use date('Y')

$startdate = date("Y-m-d", strtotime(date('Y') . '-' . $startmonth . '-01'));

Upvotes: 5

Related Questions