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?
Posted on Jan 4, 2009 at 19:32:29
Would it not be easier to use the date function?
$date = date(”l, jS F, Y”);
Example:
Sunday, 4th January, 2008
Sorry about first comment, it removed the code due to the php tags