0

A date is stored in my database like so:

2011-11-22 15:14:27

Is there a way to format it so it comes out like:

22nd November 2011

Thanks

hakre
  • 193,403
  • 52
  • 435
  • 836
panthro
  • 22,779
  • 66
  • 183
  • 324

2 Answers2

4
<?php echo date('jS F Y',strtotime($dateVar)); ?>

See: http://nl.php.net/manual/en/function.date.php

trizz
  • 1,447
  • 12
  • 27
0

so you are mor flexible wih the format

function convertTime($time = FALSE, $to = FALSE){
    if(!$to) $to ='jS F Y';
    return date($to, strtotime($time));
} 
Abadon
  • 287
  • 2
  • 10