鉴于1328520572为日期字符串, 我怎样才能得到它从特定格式的日期时间?
我想使用
str = '1328520572';
str_ret=datetime.Parse("M:D:Y H:M:S",str);
鉴于1328520572为日期字符串, 我怎样才能得到它从特定格式的日期时间?
我想使用
str = '1328520572';
str_ret=datetime.Parse("M:D:Y H:M:S",str);
$str = '1328520572';
echo date("M:D:Y H:M:S", (int)$str);
但你的日期格式不对,请检查正确的格式here。
正确格式化datetime
?
$unix = '1328520572';
$datetime = date('Y-m-d H:i:s', $unix);
$ str_ret = date(“m:d:Y H:i:s”,$ str);
和str会是一个时间戳, 你也忘记了$之前的变量;-) – 2012-02-06 09:57:54
试试这个:
$str = '1328520572';
$str_ret = date('M:D:Y H:M:S', strtotime($str));
给我们一个线索:你认为什么日期/时间,它应该返回? – symcbean 2012-02-06 09:52:16
http://codepad.viper-7.com/SclLQW – Gordon 2012-02-06 10:11:59
请在提问之前使用搜索功能。谢谢。 – Gordon 2012-02-06 10:12:56