patricia perez patricia perez - 16 days ago 4
PHP Question

How to get the year in 2 digits in php?

I want to get the year in 2 digits like 15.

using the php date() function

echo date("Y");


but this returns the full year.

any help is much appriciated. Thanks!

Answer

Change the upper case 'Y' to lower case 'y'

echo date("y");

PHP documentation

y   A two digit representation of a year