从自定义帖子类型的自定义字段中获取并打印日期

时间:2017-11-02 12:52:15

标签: php wordpress

我使用日期选择器在自定义字段中选择了一个日期。现在我希望在日期格式化中获取该日期,并单独打印日期,如日,月和年。

<div class="infocou">

            <div class="tr_co col-xs-12">
              <img src="<?php echo $featured_img_url;?>" id="trian_img">

              <h2><a href="<?php echo $permalink_training; ?>" class="title-training">
              <?php echo $trainingtitle; ?></a></h2>
              <img src="<?php echo get_template_directory_uri().'/assets/images/tran_ico.png';?>">
              <h3><?php echo $training_duration." ".$training_timings;?></h3><br/>
              <h3><?php echo $training_date;?></h3><br/>
              <h4><?php echo $training_type;?></h4>
            </div>
            </div>
        <?php } ?>-->

        <?php

        ?>

    <h6><?php **echo $training_date;(i want to print day of the event date here)** ?><br/><span>Sept</span></h6>
    <div class="infocou">
      <h5>Introduction <br clear="hidden-sm hidden-xs" />To Programming</h5>
      <img src="<?php echo get_template_directory_uri().'/assets/images/cour_icon.png';?>"> <i>8:00 am - 10:00 am</i><br/><br/>
      <img src="<?php echo get_template_directory_uri().'/assets/images/cour_icon2.png';?>"> <i> Paathshaala Campus</i>
    </div>

1 个答案:

答案 0 :(得分:3)

使用echo date('D', strtotime($training_date));