Advertisement

How to Show date using PHP Strftime

How to Show date using PHP Strftime

In this tutorial, I am going to tell you how to show current date using PHP builtin function strftime();
It is very easy, you just need to pass some parameters to this function, which format the date.
In this tutorial, I will teach you how to show date in this format : Day, date month, Year.
For Example:

Thursday, 19 June , 2008

Well, as I said above, it is really easy.
You just put this PHP snippet on the page where you want the date to be shown:

PHP Code:
<?php
$date = strftime("%A, %d %B, %Y");
?>

And then, where ever you want to show the date, you just write this little text :

PHP Code:
<?php
echo $date;
?>

And thats it guys, pretty easy, isnt it?



Post a Comment