2013-10-20 70 views
0

所以我需要用FPDF在荷蘭顯示日期。 我試過「$ this-> setlocale(LC_TIME,'NL_nl');」中間,之前和之後。但他們只是給了我一個錯誤:「致命的錯誤:調用未定義的方法PdfInvoice :: setlocale()在C:\ wamp \ www \應用程序\ controllers \ pdfinvoice.php行52」用FPDF在荷蘭顯示日期

我可以什麼現在做?

代碼:

$dateinvoice = substr($invoice[ 'dateinvoice' ], 6).substr($invoice[ 'dateinvoice' ], 3, 2).substr($invoice[ 'dateinvoice' ], 0, 2); 
    $dateinvoice = date_create($dateinvoice); 
    $dateinvoice = false === $dateinvoice ? '' : $dateinvoice->format('d F Y'); 
    $this->Cell(10); $this->Cell(40, 7, 'Datum'); $this->Cell(0, 7, $dateinvoice, 0, 1); 
+1

確定'$這個 - > setlocale'實際上是一種方法?你不是指'setlocale()'嗎? –

回答

0
/* Set locale to Dutch */ 
setlocale(LC_ALL, 'nl_NL'); 

/* Output: vrijdag 22 december 1978 */ 
echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));