簡體   English   中英

如何在Cakephp中更改日期格式

[英]How to change the Date format in Cakephp

我用這個鱈魚來顯示發票日期

    $this->SetX(135);
    $this->SetFont('Arial','B',14);
    $this->Cell(70,8,___('Date:')." ".$invoice['date'],0,0,'C',false);

但它以Y,m,d格式顯示,而我想以d,m,Y格式顯示

請問我該如何解決?

我使用此鱈魚修復了它:

        $this->Cell(70,8,___('Date:')." ".date("d-m-Y", strtotime($invoice['date'])),0,0,'C',false);

一種更干凈的方法是使用CakeTime :: format()

$this->Cell(70,8,___('Date:')." ".CakeTime::format($invoice['date'], '%d-%m-%Y'),0,0,'C',false);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM