What are some best practices for formatting and displaying time values in PHP, such as adding "Uhr" to the end of a time string?

When displaying time values in PHP, it is important to format them correctly for readability. One common practice is to add additional text, such as "Uhr" (German for "o'clock"), to the end of a time string to provide context. This can be achieved using PHP's date() function along with the desired format specifier for hours and minutes.

// Example code to format and display time with "Uhr" added
$time = time(); // Get current timestamp
$formatted_time = date('H:i', $time) . ' Uhr'; // Format time as hours and minutes, then add "Uhr"
echo $formatted_time; // Output formatted time with "Uhr"