// Create a new instance of Zend_Date for today's date $today = new Zend_Date(); // Subtract one day from the date $yesterday = $today->subDay(1); // Print the result echo $yesterday->toString(); // output: "2021-01-28T18:30:00+00:00"
// Get the user's date input, assumed to be in YYYY-MM-DD format $dateInput = "2021-01-30"; // Create a new Zend_Date instance from the user input $date = new Zend_Date($dateInput, "YYYY-MM-dd"); // Subtract 5 days from the date $newDate = $date->subDay(5); // Print the result echo $newDate->toString(); // output: "2021-01-25T00:00:00+00:00"In this example, we get the user's date input as a string and create a new Zend_Date instance from it using the specified format (YYYY-MM-DD). We then subtract 5 days from the date using subDay and print the resulting date in ISO 8601 format. Zend_Date is part of the Zend Framework, which is a popular PHP framework for building web applications.