PHP Code to print current date in various formats

PHP Code to print current date in various formats

Right now, we will figure out how to get the current date and print the date in different various organizations?

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

Recent Posts

error: Alert: Content is protected!!