Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP date actual year

Tags:

php

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?

like image 237
Wouter Avatar asked Sep 21 '25 05:09

Wouter


1 Answers

You can use date('Y')

$startdate = date("Y-m-d", strtotime(date('Y') . '-' . $startmonth . '-01'));
like image 50
rccoros Avatar answered Sep 22 '25 22:09

rccoros