gpt4 book ai didi

cakephp - CAKE PHP 更改日期格式

转载 作者:行者123 更新时间:2023-12-01 07:18:59 28 4
gpt4 key购买 nike

我有以下代码显示所有调用详细信息,我希望将“call_date”的日期格式更改为“dd-mm-yyyy”,并且在我的 calls/index.ctp 中有以下代码:

<div class="callsIndex">
<h2><?php echo __('Call Details'); ?> </h2>
<div class="bottomButtonnew"><?php echo $this->Html->link(__('Add Calls'), array('action' => 'add')); ?></div>


<table cellpadding="0" cellspacing="0">
<tr>

<th><?php echo $this->Paginator->sort('Call Date'); ?></th>
<th><?php echo $this->Paginator->sort('Call Time'); ?></th>
<th><?php echo $this->Paginator->sort('Comments'); ?></th>
<th><?php echo $this->Paginator->sort('Next Call Date'); ?></th>
<th><?php echo $this->Paginator->sort('Customer Name'); ?></th>
<th><?php echo $this->Paginator->sort('Company Name'); ?></th>
<th><?php echo $this->Paginator->sort('Employee Name'); ?></th>
<th class="actions"><?php echo __(''); ?></th>
</tr>
<?php foreach ($calls as $call): ?>
<tr>

<td><?php echo h($call['Call']['call_date']); ?>&nbsp;</td>
<td><?php echo h($call['Call']['call_time']); ?>&nbsp;</td>
<td><?php echo h($call['Call']['comments']); ?>&nbsp;</td>
<td><?php echo h($call['Call']['next_call_date']); ?>&nbsp;</td>
<td>
<?php echo $this->Html->link($call['Customers']['customer_name'], array('controller' => 'customers', 'action' => 'view', $call['Customers']['id'])); ?>

</td>
<td>
<?php echo $this->Html->link($call['Companies']['company_name'], array('controller' => 'companies', 'action' => 'view', $call['Companies']['id'])); ?>
</td>
<td>
<?php echo $this->Html->link($call['Employees']['employee_name'], array('controller' => 'employees', 'action' => 'view', $call['Employees']['id'])); ?>
</td>
<td class="actions">


<?php echo $this->Html->link(__('View'), array('action' => 'view', $call['Call']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total')
));
?> </p>
<div class="paging">
<?php
echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
?>
</div>
<br>

</div>

如何将“call_date”中的日期格式更改为 dd-mm-yyyy?有人可以帮忙吗?

最佳答案

用这个

 <td><?php echo date("d-m-Y", strtotime($call['Call']['call_date'])); ?>&nbsp;</td>

关于cakephp - CAKE PHP 更改日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23821286/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com