如何在php中打印/回显其他语言的日期

时间:2016-02-13 04:31:17

标签: php date

这就是我现在所拥有的。我想以相同的格式打印日期,但是用西班牙语或任何其他语言打印。

<?php echo date(" d F Y ",time());?>
//echoes 13 February 2016

我看了看:

setlocale(LC_TIME, "C");
echo strftime("%A");

但我无法理解它是如何运作的。

2 个答案:

答案 0 :(得分:0)

这就是它的工作原理

<?php
setlocale(LC_TIME, "C");
echo strftime("%A");
setlocale(LC_TIME, "fi_FI");
echo strftime(" in Finnish is %A,");
setlocale(LC_TIME, "fr_FR");
echo strftime(" in French %A and");
setlocale(LC_TIME, "de_DE");
echo strftime(" in German %A.\n");
?>

并浏览此链接:http://us2.php.net/manual/en/function.strftime.php

答案 1 :(得分:0)

您需要setlocale。如果您想获得更多语言代码,请访问website。有关private class CustomClass{ public int drawable; public String title; public String information; } ArrayList<CustomClass> listCustom = new ArrayList<>(); Integer[] mThumbIds = { R.drawable.akash, R.drawable.akash, R.drawable.akash , R.drawable.akash, }; String[] mThumbNames = { "akash 0", "akash 1","akash 2", "akash 3", }; String[] mThumbInfos = { "akash 0 Info", "akash 1 Info","akash 2 Info", "akash 3 Info", }; for (int i = 0; i < mThumbIds.length; i++) { CustomClass customClass = new CustomClass(); customClass.drawable = mThumbIds[i]; customClass.title = mThumbNames[i]; customClass.information = mThumbInfos[i]; listCustom.add(customClass); } 点击here

  

setlocale - 设置区域设置信息。

     

strftime - 根据区域设置格式化本地时间/日期。

strftime