How can PHP be used to properly format dates retrieved from a database for display?

When retrieving dates from a database in PHP, they are often in a standardized format like 'YYYY-MM-DD'. To properly format these dates for display, you can use the `date()` function in PHP to convert them to a more readable format. You can specify the desired format using the appropriate format characters (e.g., 'd/m/Y' for 'day/month/year').

// Retrieve date from database
$dateFromDB = '2022-01-15';

// Format date for display
$formattedDate = date('d/m/Y', strtotime($dateFromDB));

echo $formattedDate; // Output: 15/01/2022