PHP change date format

Add Tool

Php Date Format Strings


If you are new with PHP Here I have shown how to Play with PHP? Here I will share how to Php Date Format Strings work. Some time we want to display current date and time in our web site. Specially you will see current date and time with copyright text in footer area Like

Copyright ©: 2016

Now we will learn how to Php Date Format Strings using PHP. And we will make some style of date and time format. So let’s go and Play with our Php Date and Time Format Code.

Display Current Year:

To display current year use this codes

<html>
<head>
<title>PHP date and time</title>
</head>
<body>
<h3>Display Current Date PHP code</h3>
<?php 
echo "Copyright&copy; ".date("Y");
?>
</body>
</html>

It will display Copyright© 2013 (This is my PC's current Year)

Display Current Year with Day and Month

<?php 
echo "Copyright© " . date("d,m,Y");
?>

Result: Copyright© 04,09,2013

<?php 
echo "Copyright© " . date("D,M,Y"); 
?>

Result: Copyright© Tue,Sep,2013

<?php
echo date("r"); 
?>

Result: Tue, 04 Sep 2013 15:33:26 +0000

<?php 
echo "Current date and time: " . date("r") . " ";
?>

Result: Current date and time: Tue, 04 Sep 2013 15:34:44 +0000

Display Time through second

<?php   
echo "
It's been exactly " . time() . " seconds since January 1, 2000, 12:00 PM, GMT "; 
?>

Result: It's been exactly 1354637070 seconds since January 1, 2000, 12:00 PM, GMT. You can use any Date Format for your web site or your buyers web site. Generally this time is your current computer time. If you change your computer Date and Time it will changed automatically.

Your Must See: Bangla date and time php script for any php base site

<?php PHP start
echo echo or print is used to display any things in browser
“ “ Our words will be placed between this sign or contusion
; Use this sign at the end of line
. Concatenation (It uses to add two variable or text)
?> PHP en

Check date to learn more about the date function and the different formats for date and time


Tags: php change date format, php format date string, php time and date, date and time php, php date and time
Payza

About Masum Billah

Php Date Format Strings Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer.


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: PHP change date format


adf.ly