在sth中将strtotime转换为日期时间格式

His*_*ack 43 php

我需要将strtotime转换为日期btime格式(从1307595105到06/08/2011 09:51:45 PM PDT)在php中

你能给我一个答案吗?

mpo*_*nik 64

$unixtime = 1307595105;
echo $time = date("m/d/Y h:i:s A T",$unixtime);
Run Code Online (Sandbox Code Playgroud)

哪里

http://php.net/manual/en/function.date.php


Bij*_*oor 17

<?php
  echo date('d - m - Y',strtotime('2013-01-19 01:23:42'));
 ?>       
Out put : 19 - 01 - 2013
Run Code Online (Sandbox Code Playgroud)


小智 9

使用date()函数获取所需的日期

<?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
?>
Run Code Online (Sandbox Code Playgroud)

推荐用于strtotime到日期转换的在线工具:

http://freeonlinetools24.com/


Kha*_*azi 5

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