This is as simple as this

echo date('Ymd');

For the available date formats, please consult the php reference here.