Support

Account

Home Forums General Issues date picker date display in php 5.2 Reply To: date picker date display in php 5.2

  • Hi @tebbott

    Using the strtotime function should work like this:

    
    <?php 
    
    $date = get_field('date');
    // $date = 19881123 (23/11/1988)
    
    // extract Y,M,D
    $y = substr($date, 0, 4);
    $m = substr($date, 4, 2);
    $d = substr($date, 6, 2);
    
    // create UNIX
    $time = strtotime("{$d}-{$m}-{$y}");
    
    // format date
    echo date('d/m/Y', $time);
    
    ?>
    

    Good luck!

    Cheers
    E