【问题标题】:How to remove TIME END from datetime in php如何从 php 中的 datetime 中删除 TIME END
【发布时间】:2016-02-14 02:48:43
【问题描述】:

我目前有这个:

上午 9:00 - 下午 5:00

我希望它只显示开始时间:

上午 9:00

这是我的代码:

             <td class="time event-<?php echo $post->ID; ?>"><?php espresso_event_date_range( 'g:i a', ' ', ' ', ' ', $event->ID() ); ?></td>

【问题讨论】:

  • 您总是可以使用explode 来爆炸值,然后回显第一个 cll。
  • 聪明的解决办法是编辑 espresso_event_date_range 而不是编辑它的输出

标签: php html datetime


【解决方案1】:

这样使用

$exp_date = explode("-",espresso_event_date_range( 'g:i a', ' ', ' ', ' ', $event->ID() ));

<td class="time event-<?php echo $post->ID." ".$exp_date[0]; ?>"></td>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-15
    • 1970-01-01
    • 2012-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多