Support

Account

Home Forums Front-end Issues Date output Reply To: Date output

  • Sorry to revive an old thread but I pulled your code from the example above;

    <? if (get_field('date-start')) : ?>
      The next opportunities to undertake this workshop are: <br/>
      <?
      $format_in = 'yymmdd'; // the format your value is saved in (set in the field options)
      $format_out = 'D d MM'; // the format you want to end up with
    
      $date = DateTime::createFromFormat($format_in, get_field('date-start'));
      echo get_field('date-start');
      //echo $date->format( $format_out );
      echo '$date: <pre>';
    	print_r($date);
      echo '</pre>';
    
      endif;
    ?>
    

    Outputs;

    The next opportunities to undertake this workshop are:
    20150725$daten: 

    ie the date-start field is valid.
    if I uncomment this line //echo $date->format( $format_out );

    I get a fatal error.

    PHP 5.5