#example.php

<?php
echo date("d/m/Y");
echo date("d-m-Y");
echo date("d.m.Y");
?>

  • d - Represent day of the month
  • D - Represent day of the week 
  • m - Represent month in numbers 
  • M - Represent month in tex
  • y - Represent year in two digits 
  • Y - Represent year in four digits 

Day of the week, AM or PM, etc with PHP.


#example.php

<?php
echo date("h:i:s");
echo date("F d, Y h:i:s A");
echo date("h:i a");
?>

  • h - Represent hour 
  • H - Represent hour in 24-hour 
  • i - Represent minutes 
  • s - Represent seconds 
  • a - Represent lowercase am or pm
  • A - Represent uppercase AM or PM