the_time() cannot be placed correctly

    <?php the_time() ?>

It helps with separation of concerns and increases readability of code as well as being consistent with WordPress coding standards and the default coding style.

The first method you attempted is completely invalid, the_time() only accepts 1 parameter, the date format. The second method has roots in validity, but the_time() itself is already doing an echo, so by calling it in the middle of the string, you’re preempting the outer echo and probably getting the time and an empty p. If you want to use that method you can go with this:

echo '<p>' . get_the_time() . '</p>';

Since get_the_time() returns its value whereas the_time() echos it.


To use the $format parameter correctly:

<?php the_time( 'd. F Y' ) ?>

Note: for a publicly released Theme, it is recommended to use the user-defined date/time format:

<?php the_time( get_option( 'time_format' ) ); ?>

You can also pass the date format to the_time() if you need to output the date for each post in the loop. The the_date() function only outputs the date upon the first occurrence. So, if multiple posts have the same date, the date will only be output once. To get around this limitation, use the_time( $date_format ) instead:

<?php the_time( get_option( 'date_format' ) ); ?>