2016-04-28 73 views

回答

0

如果你看看date手动php的这将是容易: - http://php.net/manual/en/function.date.php

<?php 
$date = '03/09/2016'; // your actual date 
echo date("j M Y", strtotime($date)); // conversion into string format 

输出: - https://eval.in/561036

这里: -

j = Day of the month without leading zeros (1 to 31) 
M = A short textual representation of a month, three letters(Jan through Dec) 

注意: - 如果你不想要year您可以简单地从echo date("j M Y", strtotime($date));删除Y

2

date()函数格式化本地日期和时间,并返回格式化的日期字符串。

  • J =当月没有前导零(1到31)
  • M =一个月的短文本表示(三个字母)

简单地使用天这样的:

$date = "03/09/2016"; 

echo date("j M", strtotime($date)); 

结果

3月9日

0

假设你的日期可以使用的DateTime库解析:

$date = new DateTime('2000-01-01 10:34:44'); 
echo $date->format("Y-M-d"); 

这将输出2000-Jan-01。 所有不同日期的输出类型罗列如下:http://php.net/manual/en/function.date.php

相关问题