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