将日期格式更改为荷兰语 [英] Change date format into Dutch language
本文介绍了将日期格式更改为荷兰语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码是:
$ date_arr = explode(' - ',$ eventPublishDate);
$ datetime = mktime(0,0,0,$ date_arr [1],$ date_arr [2],$ date_arr [0]);
$ enterted_date = date(jS F Y,$ datetime);
$ newDate = date(jS F Y,strtotime($ eventPublishDate));
我尝试下面的代码,但无法找到日期的后缀[th,nd ...] / p>
if(setlocale(LC_ALL,'nld_nld')|| setlocale(LC_ALL,'nl_NL')){
$ newDate = strftime(%d%B%Y,mktime(0,0,0,$ date_arr [1],$ date_arr [2],$ date_arr [0]));
}
我需要输出:15th januari 2014
请帮我解决问题。
解决方案
使用intl模块:
$ fmt = new IntlDateFormatter(
'nl_NL',
IntlDateFormatter :: GREGORIAN,
IntlDateFormatter :: NONE
);
echo $ fmt-> format(mktime(null,null,null,1,15,2014));
//输出:15 januari 2014
I have a date format in English and i want to change it into Dutch language.
my code is:
$date_arr = explode('-', $eventPublishDate);
$datetime= mktime(0, 0, 0, $date_arr[1], $date_arr[2], $date_arr[0]);
$enterted_date = date("jS F Y",$datetime);
$newDate = date("jS F Y", strtotime($eventPublishDate));
I tried below code but not able to find suffix [th, nd...] of date
if ( setlocale(LC_ALL, 'nld_nld' ) || setlocale( LC_ALL, 'nl_NL' ) ) {
$newDate = strftime("%d %B %Y", mktime(0, 0, 0, $date_arr[1], $date_arr[2], $date_arr[0]));
}
I need output in : 15th januari 2014
please help me sort out the issue.
解决方案
With the intl module:
$fmt = new IntlDateFormatter(
'nl_NL',
IntlDateFormatter::GREGORIAN,
IntlDateFormatter::NONE
);
echo $fmt->format(mktime(null, null, null, 1, 15, 2014));
// output: 15 januari 2014
这篇关于将日期格式更改为荷兰语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文