2011-03-14 62 views
36

我需要的strtotime在PHP轉換爲日期BTIME格式(從1307595105至2011年6月8日下午9時51分45秒PDT)轉換的strtotime在PHP日期時間格式

能不能請你給我一個答案

+9

http://php.net/strtotime和格式化日期,http://php.net/date - 信息都在那裏。 – 2011-03-14 10:48:57

回答

12
<?php 
    echo date('d - m - Y',strtotime('2013-01-19 01:23:42')); 
?>  
Out put : 19 - 01 - 2013 
+0

這甚至不是被問到的問題。 – 2016-03-19 07:56:24

4
FORMAT DATE STRTOTIME OR TIME STRING TO DATE FORMAT 
$unixtime = 1307595105; 
function formatdate($unixtime) 
{ 
     return $time = date("m/d/Y h:i:s",$unixtime); 
} 
7

使用date()功能,以獲得所需日期的strtotime

<?php 
// set default timezone 
date_default_timezone_set('UTC'); 

//define date and time 
$strtotime = 1307595105; 

// output 
echo date('d M Y H:i:s',$strtotime); 

// more formats 
echo date('c',$strtotime); // ISO 8601 format 
echo date('r',$strtotime); // RFC 2822 format 
?> 

推薦在線工具,日期轉換:

http://freeonlinetools24.com/

0

這裏是進出口。

$date_search_strtotime = strtotime(date("Y-m-d")); 
echo 'Now strtotime date : '.$date_search_strtotime; 
echo '<br>'; 
echo 'Now date from strtotime : '.date('Y-m-d',$date_search_strtotime);