How to Display Today’s Date in WordPress

If you are creating any Blog, Magazine or any
content based WordPress website, then you may need to
show the current date on the top of the website.

You can use php date function for this. Inside function
you can change the formate by parameter formate changes.


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

This funciton return output in following formate.

Monday, 11th September 2017

Here is more options that you can use to chnage the date formate.

<?php
$date = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$date = date("m.d.y"); // 03.10.01
$date = date("j, n, Y"); // 10, 3, 2001
$date = date("Ymd"); // 20010310
$date = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
$date = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day.
$date = date("D M j G:i:s T Y"); // Sat Mar 10 17:16:18 MST 2001
$date = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:18 m is month
$date = date("H:i:s"); // 17:16:18
$date = date("Y-m-d H:i:s"); // 2001-03-
?>

Thanks for reading this article.
Hope it will help you a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *