the_date

TIME/DATE TAG

What It Does

Displays an individual or a group of posts that were published on the same day (date). the_date must be used within The Loop.

Code

<?php the_date(‘format’, ‘before’, ‘after’, echo); ?>

Format

The date can be displayed in a variety of different formats. For more information, see PHP Date.

Before

What to display before the date is shown.

After

What to display after the date is shown.

Echo

Allows you to either display the date or to keep it for use later in the PHP script.

  • TRUE (default value)
  • FALSE

Example

<?php the_date(‘F j, Y’, ‘Date Posted: <strong>’, ‘</strong>’); ?>

The above example would display something like:

Date Posted: March 20, 2009