0
我試圖在duth中取得我的日期。我將日期分成單獨的月份,日期和年份變量,並將月份數字更改爲文本,但現在我需要進入荷蘭語而不是英語。我發現一些關於它的信息,比如setlocale(LC_ALL, 'nl_NL')
,但是我不能讓它工作。在荷蘭取得月份名稱
<?php
include_once("db/db.php");
$statement = $db_con->prepare("select * from news_article where id > :id");
$statement->execute(array(':id' => 0));
$list = $statement->fetchAll(PDO::FETCH_ASSOC);
?>
<?php
foreach($list as $col)
{
// splitting into seperate month day year
$orderdate = explode('-', $col['datum']);
$year = $orderdate[0];
$month = $orderdate[1];
$day = $orderdate[2];
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName =
$dateObj->format('F');
?>
//this needs to output in dutch
<p class="month"><?php echo $monthName ?></p>
看看http://stackoverflow.com/questions/13845554/php-date-get-name-of-the-months-in-local-language –
DateTime :: format ()不知道區域設置(http://php.net/manual/en/datetime.format.php#refsect1-datetime.format-notes),請使用strftime()代替 –