yestaurday date() php code example Example: php yesterday $yesterday = new DateTime('yesterday'); echo $yesterday->format('Y-m-d');