Home » Internet » Blogging » WordPress » How to format dates for your WordPress blog

How to format dates for your WordPress blog



Many people prefer to publish dates on top of their WordPress blogs to let their visitors know exactly when the blog post was published. The format of the date in WordPress can be changed according to your preference, or the way your theme has been designed. For example, you can display your dates using the following formats:

  • June 01, 2010
  • Tuesday, June 01, 2010
  • Tue-05-01-10

There can be umpteen formatting combinations. Just make sure they’re easily understandable.

As you know WordPress is built using PHP so many of its functions resemble PHP functions. You can see various PHP date formatting options on this PHP link.

In WordPress the easiest way of changing your date format is through your admin dashboard. After logging in, go to Settings and under Settings click General. Scroll down a bit until you reach the Date section.

Formatting dates in WordPress

If you don’t need anything complicated you can simply use the radio button to select a particular format. If you want to do your own thing, then you can enter the parameters in the last radio button. Different letter, upper case and lower case, represent various options for printing days, months and years. Separators like dash, comma, colon appear as it is. Some of the formatting alphabets are:

  • j = The day of the month without leading zero (1, 2, …, 31)
  • d = The day of the month with leading zero (01, 02, …, 31)
  • S = The ordinal suffix like like st (as in 1st), or nd (as in 2nd), so “The jS of F” gives “The 1st of June”
  • F = The full name of the month
  • m = Numeric month with leading zero (01, 02, …, 12)
  • n = Numeric month without leading zero (1, 2, …, 12)
  • M = The first three letters of the textual month (Jan, Feb, …, Dec)
  • Y = The year, all four digits
  • y = The year with the last two digits
  • l (small L) = The full name of the weekday
  • D = The first three letters of the name of the weekday (Sun, Mon…)

You can use the various combinations of these letters to format dates in your WordPress blog.