4

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?

Wouter
  • 465
  • 2
  • 7
  • 24

2 Answers2

5

You can use date('Y')

$startdate = date("Y-m-d", strtotime(date('Y') . '-' . $startmonth . '-01'));
rccoros
  • 590
  • 9
  • 19
2

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

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

Personal experience in researching in Google.

  • @Denis Frezzato already comment out the link for the answer, and he want month and day as well – vishal Dec 16 '15 at 11:20