Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Display Today’s Date in WordPress?

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Display Today’s Date in WordPress?

A trend of displaying current date which was started with newspapers has been adapted by many blogs. As more and more users are using WordPress to create magazine style theme, this is just one of the features that can be a great addon to your site. Having a current date looks professional, and it is certainly useful if your articles are dated. You might think that adding a date to WordPress is hard and will require multiple steps, but it is a short and simple method. In this article, we will share a snippet that will allow you to display today’s date in WordPress or any other PHP based website.

All you need to do is place the following code in a theme file of your choice, most commonly in header.php:

<?php echo date('l jS F Y'); ?>

The above code will display the date in the following format:

Thursday, 17th September 2009

If you do not like the formatting above, you can look at the PHP Date Manual for other parameters.

Now another way to do this is by just extracting your WordPress admin settings. You can go to Settings > General and select the date format in there and simply add this code instead of the above one:

<?php echo date(get_option('date_format')); ?>

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. shiva says:

    very nice

  2. anees says:

    thanks a lot !!

  3. Jon says:

    Or with Javascript:

    var dateToday = new Date(); var yearToday = dateToday.getFullYear(); document.write(yearToday);

  4. Abiodun says:


    how do I change the color of this code?

    it is in an arch colour and i want it in white

  5. sameh says:

    How can i change the language of date format to arabic???? thanks advanced

  6. morteza ahamadi says:

    i am realy beginner,
    where should these codes be added?

  7. 123project says:

    how can I change the font and the color of this code?

    • WPBeginner Support says:

      Using CSS you can change the colors. To use css add the date template tag like this:

      <span class="date"><?php echo date('l jS F Y'); ?></span>

      Now in your theme’s style sheet you can add CSS, like this:

      .date { 
      color: blue;
      border: 1px solid #CCC; 
  8. Clare says:

    I’m beginning to discover that you can do anything with WP if you just take the time out to learn how – and most of it is so simple. 2011 is the year to ditch plugins and take the weight off my site!

  9. Petit Nuage says:

    Your suggestion is incorrect, since you’ve forgotten to take the local timezone into account as defined in the Dashboard.

    • Editorial Staff says:

      We mentioned two solutions. One where you can use the server’s setting, or two where you can use WordPress setting. If you have a third solution, then please share it with us rather than saying that we are wrong because both solutions above work.

  10. andreeib says:

    I used to make this using a short code function in WordPress.

  11. Chase Adams says:

    Why not just use Isn’t it a lot easier as a built in function where you can change the display type in Settings > General ?

  12. Cheap Sites says:

    Yeah, that was really simple! Thank you for sharing =D

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.