patricia perez patricia perez - 1 year ago 72
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 Source

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

echo date("y");

PHP documentation

y   A two digit representation of a year
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download