PHP date yesterday

26.Jul.2010

Sometimes, you just have to know what was the previous date. So, in order to use PHP to tell you what was date yesterday, use following snippet:

1
2
3
4
5
function date_yesterday() {
	return date('d.m.Y', strtotime( '-1 days' ));
}
 
echo 'Yesterday was: ' . date_yesterday();