What are the best practices for manipulating and displaying date and time values retrieved from a MySQL database in PHP?

When retrieving date and time values from a MySQL database in PHP, it is important to properly format and manipulate them for display. One common practice is to use the PHP date() function along with the strtotime() function to convert the MySQL datetime format to a more readable format. Additionally, you can use the DateTime class in PHP to perform date and time calculations and formatting.

// Retrieve date and time value from MySQL database
$mysqlDateTime = "2022-01-15 14:30:00";

// Convert MySQL datetime format to a more readable format
$phpDateTime = date("F j, Y, g:i a", strtotime($mysqlDateTime));

// Display the formatted date and time value
echo $phpDateTime;