×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How to display the date in an appropriate format using PHP?


PHP - How to display the date in an appropriate format using PHP?

You should use the special date function in PHP.

Take a look at the example
<?php 
   echo date("D M d"); 
  ?> 
   
  will display: Mon Feb 03
   
  where 
   
  Y = Year eg. 2003 
  y = Year eg. 03 
  M = Month eg. Jan 
  m = Month eg. 01 
  D = Day eg. Fri 
  d = Day eg. 03 
  z = Day of the year eg. 002 
  H = Hours in 24 hour format eg. 07 
  h = Hours in 12 hour format eg. 7 
  i = Minutes eg. 29 
  s = Seconds eg. 28 
  U = Seconds since epoch eg. 1041604168

Category: PHP

 
<< Go back