Home »
PHP »
PHP Programs
PHP Code to print current date in various formats
In this PHP code, we will learn how to get current date and print the date in various different formats?
Source Code and Output to get and print Current Date
<?php
/*print date in dd/mm/yy format*/
print "Current date in dd/mm/yy format: " . date("d/m/y");
print "</br>";
/*print date in dd/mm/yyyy format*/
print "Current date in dd/mm/yyyy format: " . date("d/m/Y");
print "</br>";
/*print date in dd MON yyyy format*/
print "Current date in dd MON yyyy format: " . date("d M Y");
print "</br>";
/*print date in Day, dd MON yyyy format*/
print "Current date in Day, dd MON yyyy format: " . date("D, d M Y");
print "</br>";
/*print date in Day, dd MONTH yyyy format*/
print "Current date in Day, dd MONTH yyyy format: " . date("D, d F Y");
print "</br>";
?>
Output
Current date in dd/mm/yy format: 08/11/16
Current date in dd/mm/yyyy format: 08/11/2016
Current date in dd MON yyyy format: 08 Nov 2016
Current date in Day, dd MON yyyy format: Tue, 08 Nov 2016
Current date in Day, dd MONTH yyyy format: Tue, 08 November 2016
The following PHP topics are used in the above examples:
PHP Basic Programs »