Posted By

depmed on 08/06/07


Tagged

date


Versions (?)

Explode date


 / Published in: PHP
 

URL: http://us3.php.net/date

  1. This is a very simple few lines of code to display dates that arrive in various formats:
  2.  
  3. $dateArray=explode('-','2007-02-05');
  4.  
  5. // $dateArray[0]= 2007
  6. // $dateArray[1] = 02
  7. // $dateArray[2] = 05
  8.  
  9. echo date('M j, Y', mktime(0, 0, 0, $dateArray[1], $dateArray[2], $dateArray[0]));
  10.  
  11. // result: Feb 2, 2007
  12.  
  13. alter your explode characters and dateArray positions to suit.

Report this snippet  

You need to login to post a comment.